Thread: Cookies Session Help
Results 1 to 9 of 9
10-25-2003, 01:57 PM #1
Cookies Session Help
I have a vote site, and when the user clicks on vote, it adds one to the database and writes a cookie so they can't vote again.
A few people tested this out, some were able to hit the "BACK" button and then Vote again, and the vote would count. Others who hit the "BACK" button and voted again, the checker to see if the cookie was "NULL" kicks in, and doesnt let them get another vote in.
Why does it let some people vote again, and others it will not. Its not a matter of them deleting their cookies, they are just able to hit back and vote and back and vote, and all go through.
Here is the code to see if its null or not.
If Request.Cookies(gamertag_prof)(gamertag_prof) = "" Then
Response.Cookies(gamertag_prof)(gamertag_prof) = "voted"
Response.Cookies (gamertag_prof).Expires = DATE + 3
10-25-2003, 02:29 PM #2
The problem with cookies is that they are user-based.
Most voting systems rely on either registration or checking the users ip address in a rolling ip log.
10-25-2003, 02:37 PM #3
Yea, but Ip's change daily on most ISP's
So I went with a cookie system, any ideas why the back works for some and not for others?
10-25-2003, 03:23 PM #4
What I've found out is that the cookie is not even being written.
It writes the cookie fine for the login info. For that I hard code in the name and the field. But for this cookie, it is dynamically created. Could this be the reason for the the problems, but only on some users computers?
10-25-2003, 03:41 PM #5
Could it be that the user has cookies set to 'off'?
10-25-2003, 04:15 PM #6
Nope, there are two cookies I write, one for the login and one for the votes on each person. The login one works fine for everyone. But the one for the vote does not write, but only to a few users.
Thats why im thinking it could be because the cookie name is dynamically created along with the field. But im stumped as to why most users have no problems, but some do.
10-25-2003, 04:21 PM #7
Would it be possible to write the variables to the screen (maybe setup a 'debug mode' or similar) and get someone who it fails for to save that page and send it to you? We migth be able to narrow down whether its the variables or not.
10-25-2003, 05:34 PM #8
Yea, the page uses the same variables throughout, so it can't be that. Plus the fact that it works for most seems to rule that out. I was thinking it must be some kind of browser settings, or some sort or problem with a certain setup not being to store dynamic cookies.
10-25-2003, 06:34 PM #9
mm. Problem is, the browser should be recieving the same data whether its produced dynamically or not.
I think this may have to be elimination. It might be worth talking a user through his browser settings, see what (if any) differ from yours.