SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question logging ips in mysql

    I'm writing a poll script, and I want to know how you would check to see if they voted for the poll or not. Now that's pretty simple, but how would you check if they've voted for multiple polls? Would I create a row with their ip address and what pollid's they've voted for (ex. 4,7,1,etc)?

    Thanks in advance
    -Magriep

  2. #2
    SitePoint Wizard Chris82's Avatar
    Join Date
    Mar 2002
    Location
    Osnabrück
    Posts
    1,003
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would use an additional table "vote_ip" where you store the vote id and the ip.

  3. #3
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would probably use cookies... if they are using dial-up, their IP will change everytime they login into the Internet. So by using cookies, you can store it on their PC for as long as you need... say 1 month and if they vote within that month you'll see what polls they used..

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a way to log it in mysql? Because I want to make sure there are no double votes and the only way I see doing that is with mysql since normal visitors don't have access to mysql administration.
    -Magriep

  5. #5
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Magriep
    Is there a way to log it in mysql?
    Of course

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know to add a row, but I'm not exactly sure how to seach for that specific ip and see what polls they voted for. And to get their ip, I would use $HTTP_ADDR correct?
    -Magriep

  7. #7
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I mentioned in my first post - I wouldn't use IP UNLESS it's OK to double-vote the next day or even several hours later. IP will change and you won't be able to tell if it's a double-vote or not. With cookies you won't have problems. If they don't have cookies enabled (most do), then you can rely on IP thingy.

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks
    -Magriep

  9. #9
    SitePoint Enthusiast atomical's Avatar
    Join Date
    Aug 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't use sessions.

    These are the reasons why:
    *You can always have cookies turned off
    *You can always delete a cookie from a particular site

    The only way you can fake your IP is by using a proxy, which isn't likely from the average user. Store the IP in the same table.

    $REMOTE_ADDR is the variable for the IP address

  10. #10
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If they are using dial-up, their IP will change everytime they login into the Internet.

  11. #11
    Forum Mathematics Geek Agent Dwarf's Avatar
    Join Date
    Aug 2002
    Location
    Commonwealth of Pennsylvania
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If they're using a proxy, someone who hasn't voted may be denied, also.

  12. #12
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The common way of doing this is to use cookies & ip's. Though IP's should give you pretty good control over abuse. You will NEVER stop someone who is determined to abuse it. But hopefully the abuse will be obvious.

    As with all locks, they are designed to keep honest people honest. They'll never stop someone who's hell bent on causing trouble.

    Using ip's is a great measure and should be all you need. If your just plain bored, add the cookies to make it a little harder for the average joe.
    Chrispian H. Burks
    Nothing To Say

  13. #13
    SitePoint Enthusiast atomical's Avatar
    Join Date
    Aug 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Pweb
    If they are using dial-up, their IP will change everytime they login into the Internet.
    I'm sure it will be fine.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •