| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Run once only, not on refresh|
php counter problem
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.
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.
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.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved