| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor|
|Run once only, not on refresh|
php counter problem
| 2:30 am on Feb 27, 2003 (gmt 0)|
I have a PHP hit counter script that uses a flat file for a hit count, the problem is that if a user hit refresh the hit count goes up!
Is there a way to make this block of code execute one time only in some sort of IF stament?
I found include_once() but that was no help.
| 2:56 am on Feb 27, 2003 (gmt 0)|
You could make a quick function that checks for a cookie, then if it is not present it sets one.
Then you increment your counter only if the cookie does not exist.
| 3:18 am on Feb 27, 2003 (gmt 0)|
I thought of doing that after I made this post, and all is fine now!
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2013 all rights reserved