I have a site that counts each time a page is hit (photo is viewed). It is a simply script that adds one each time the page is hit in the database. Well, it appears that some people have figured out that all they have to do it keep hitting refresh and the count will just keep incrementing. Is there a way to write something that will limit the users vote just once per session, or day. I dont want to create a whole table in the database just to keep track of who has viewed what.
Thanks!
Matthew http://rosterpix.com
First thing that came to my mind in this case is to set a session variable and then set it to 1 if they have viewed, 0 if they have not.
If the variable equals 0, add the hit, if 1, ignore it.
-Sys
Originally posted by sysera First thing that came to my mind in this case is to set a session variable and then set it to 1 if they have viewed, 0 if they have not. If the variable equals 0, add the hit, if 1, ignore it. -Sys
With almost 9000 photos on the site, does that mean I will need to set a session variable for each one when they view it? That sounds like the potential of a lot of variables!
Matthew
Originally posted by MKSolutions With almost 9000 photos on the site, does that mean I will need to set a session variable for each one when they view it? That sounds like the potential of a lot of variables! Matthew
I believe you could store the info as an array in the variable with all the photos they've viewed in that sessions.
Perhaps one of the more experienced coders here could chime in if this would be a reasonable solution?