Pag schrieb:
>     
>     Hi,
> 
>     I have a news site where i want to track how many "visits" or reads
> each individual news has. I have a main list with all the titles, then
> clicking on them shows the details of the specific news, only then the
> counter for that particular news is increased. The problem is, if the
> user does a refresh while at the details, the counter is increased
> again. How can i prevent this from happening?
> 
>     I thought it would be something like a unique counter problem, but
> its like having a "counter problem" for each news i have. :-P
> 
>     What would be nice, if it exists, is to check if the user is doing a
> refresh or coming from somewhere else. If its a refresh, the counter
> would simply not increase. That would be sufficient to keep the
> i-want-my-news-to-have-the-higher-number-of-visitors author, from having
> his way.
> 

maybe store the counter in a mysql database including the IP of the viewer
and the timestamp when he visited this page. If he shows the news the first
time store the IP with timestamp and the viewd news in the database.
If he view it again first check if this IP viewed this news lately.
Remove all IP which been older than maybe 8 hours afterwards.

Another option is to store this info in cookies or sessions ...

-- 
 @  Goetz Lohmann, Germany   |   Web-Developer & Sys-Admin
\/  ------------------------------------------------------
()  He's the fellow that people wonder what he does and
||  why the company needs him, until he goes on vacation.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to