a real simple thing i do is to increment the counter
then use header() to redirect to same page with a variable added.
so at the top of details.php i put..

if(!$_GET['no_count']){
...increment counter
header("location:...details.php?no_count=on");
exit;
}

of course people can always just manually edit the url in the address bar
in which case you could probly use http_referer  to check.
for my purposes most of the visitors won't edit the url so it's not too
important.



----- Original Message -----
From: "Pag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 15, 2003 6:08 AM
Subject: [PHP] How to check for refresh in PHP


>
> 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.
>
> Thanks.
>
> Pag
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

Reply via email to