backup interface / count link-clicks

Creating and modifying plugins.
Post Reply
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

backup interface / count link-clicks

Post by sph »

heyho everyone!

i found two plugins which i like to use, but i've got some questions to both of them.


1: the "backup interface" plugin.

i thought this plugin could be useful in case of any trouble with my s9y, so i installed it. there's a new link to the interface in the admin-menue now, but if i click there some errors are shown to me.

there are some opendir(), readdir() and closedir() - php-errors shown and there is also a path which does not exist:

Code: Select all

... /subdomains/blog/backup/
looks a little strange to me, because s9y is installed in:

Code: Select all

... /subdomains/blog/httpdocs/
and the 'blog'-directory itself couldn't be reached via web. i can create this directory if needed via shell-access, but i don't know if this would solve this problem. but... shouldn't the "backup"-dir be in the web-allowed path "blog/httpdocs"?

i'm not very good in this things, so i decided to ask here first - before making something really stupid ;)



2: the "count extern links" plugin.

i really want to count the links people clicked on my site. i guess this plugin does exactly that. but... where can i check the stats? i am using the "statistics"-plugin, too. it shows me the top-exit sites (in my case the top-10), but not a full list, which i like to have.

what's this plugin counting, and where does it count? where can i have a look at the numbers? and what must be done to count not only links in entries, but also links on static pages, or in short: everywhere on my s9y installation?

is this possible?






oh, and i've another question, it's about the "statistics"-plugin:


why do my top exits always change? and i do not mean they change their position in the ranking, there is something different wrong. my page isn't visited very often, so i'ts easy to keep an eye on it.

an example: one of my exit sites says it's been clicked on 5 times. so, if i click some different site more often, the different page should be listet above the five-times-clicked on... right? (let's assume i tried that, even with different ip's in case the plugin only counts unique visits...). well, the "different" site is not at the list.

strange.

and i have the feeling the clicked-on-numbers of this exit-sites do change. maybe today site xyz.com has been clicked on 5 times, another time the same site counts 15 clicks and then, again the same site, it counts only 3 exits. i really don't understand this at all....



is there someone able and willing to help me to geth this things working?


i hope so, what else can i do...


thank you for reading, thanks for your answer (and sorry for my bad english),

sph
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: backup interface / count link-clicks

Post by garvinhicking »

Hi!

1. Yes, the backup plugins saves backups outside the HTTP directory so that backup file scannot be accessed via HTTP, that's a security restriction.

2. The statistics are displyed in either the "Top Exits" sidebar plugin, or in the Serendipity Statistics event plugin. You are right, a full list is not displayed. For that, you can only use phpMYAdmin to browse the serendipity_exits table, or modify the PHP code of that plugin.

Only blog entries can be tracked by that plugin. You (or someone else) would need to write a new tracking plugin if you want to track other pages, like static pages.
why do my top exits always change?
They're related to the current week.

Exit pages are only tracked if different visitors click the same link on the same day more than once. A single click of a single visitor does AFAIR not inrease the click statistic to prevent spam.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

hi!

thanks for your answer! but now i've got some further questions...

1: the backup thing.


i created the "backups"-folder as wanted with the permissions 777. i tried different owners and groups, the following errors are still shown:

Code: Select all

Warning: opendir() [function.opendir]: open_basedir restriction in effect. File(/srv/.../blog/backups) is not within the allowed path(s): 
(/srv/.../blog/httpdocs:/tmp) in /srv/.../blog/httpdocs/plugins/...backup.php on line 1316

Warning: opendir(/srv/.../blog/backups) [function.opendir]: failed to open dir: Operation not permitted in /srv/ ... /blog/httpdocs/plugins/...backup.php on line 1316

Warning: readdir(): supplied argument is not a valid Directory resource in /srv/ ... /blog/httpdocs/plugins/...backup.php on line 1317

Warning: closedir(): supplied argument is not a valid Directory resource in /srv/ ... /blog/httpdocs/plugins/serendipity_event_backup/serendipity_event_backup.php on line 1326

doesn't look right to me, so i didn't try to create a backup. what's wrong with this directory? why doesn't it work?

could it be that i've to change some php-settings to reach this folder?




2: the link-click-counter

ah, okay - now i understand this "top exits"-behaviour. but... don't the "statistics"-plugin count this exits? what does the "count extern links" plugin do, then?

or did you mean i can only have a look at this stats using phpMYAdmin?
hm, bad thing... not very comfortable.

is there anyone who can show me how to integrate a full exit list in the admin interface? maybe it's possible to place it in the statistics page, instead of the weekly top-exits?

i found the part in the 'serendipity_event_statistics.php' on line 525:

Code: Select all

<?php echo serendipity_displayTopExits($max_items, true); ?>
where's the rest of this function? is it a function? what must be done to insert the "serendipity_exits"-table here?

i hope this is possible...




to count the clicks on my staticpages i tried to write my own little script and it works now, but i don't know if it's a good idea to use it. maybe someone here can correct me?

here is what the script does:

- it stores the link-destination which is given via GET-variable
- it's opening and reading a .txt-file where the targets and clicks are stored (flatfile database)
- it's re-writing the .txt each time a link is clicked. it writes line after line, by following rules:
---> if the actual line isn't containing the target url, it's written as it was before,
---> if the actual line contains the target url, the counter increases
---> if the target url isn't already stored in the .txt, its added at the end.
- at least there is a redirection via header-location


i know, there are lots of ready-to-use scripts out there, but most of them are "overloaded" and i like to play around with php. it's not the best thing ever, but it'll be perfect for me. but there are some things i'm thinking about:

1: is it okay to leave a textfile with chmod 777 on the server? could this be bad? could it be missused?

2: what happens in case two (or more) links are clicked the same time? will the script work as normal? what can i do to prevent crashes or errors? in any case, the person who clicked on a link must be redirected. but if possible i don't want to work with sessions, is there a simple way to handle this case without?

3: because i re-write the .txt every time something is clicked, i wonder about the times this takes. what do you think, how many links can be stored without taking to much time? 10? 100? 1000?

i'd like to use this for my staticpages only, let's assume there are ~100 links i like to count....



hell, lots of questions - but thanks for reading anyway, hope to get some answers here.

nice day,

sph
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

1. Yes, you need to ask your provider if he can add your top level directory to the open_basedir PHP restriction, because your PHP denies you access to that direcory.

2. The two plugins are bundled. Statistics only shows the output of the TopExits plugin.
or did you mean i can only have a look at this stats using phpMYAdmin?
hm, bad thing... not very comfortable.
Old exits can only be viewed with the database, viewing old ones is not part of the current plugin. If you know some PHP, you could have a look at the statistics plugin, it simply executes DB queries that you could modify to fetch all given exits.
where's the rest of this function? is it a function? what must be done to insert the "serendipity_exits"-table here?
Please search the files in the include/ directory. I think it'S in include/functions_config.inc.php or something like that.

Sadly I don't have the time to inspect your statistics tracking external code at the moment...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

hi again!

thank you for taking your time to answer me!

oh, so it's not as easy as i thought, but now i've got some hints and i'll see what i can do.

any other ideas are welcome,


greets,

sph
the island of stupid - come to where the monkey is...
Post Reply