55 users online (1 members and 54 guests)  


  Results 1 to 9 of 9

Related

  1. auto increment session variable name?    Forum: PHP Forum
    Replies: 1
  2. Login Page with session    Forum: ASP Forum
    Replies: 1
  3. cookies in PHP    Forum: PHP Forum
    Replies: 1
  4. cookies    Forum: General Discussion
    Replies: 3
  1. #1
    Zamees's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    19

    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.

    PHP Code:
        If Request.Cookies(gamertag_prof)(gamertag_prof) = "" Then 
            Response
    .Cookies(gamertag_prof)(gamertag_prof) = "voted"
            
    Response.Cookies (gamertag_prof).Expires DATE 

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    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.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Zamees's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    19
    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?

  4. #4
    Zamees's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    19
    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?

  5. #5
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Could it be that the user has cookies set to 'off'?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  6. #6
    Zamees's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    19
    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.

  7. #7
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hmm.

    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.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  8. #8
    Zamees's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    19
    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.

  9. #9
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    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.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread