Preventing Spam

Discussion in 'PHP' started by Hecky, Sep 6, 2010.

  1. #1
    Hey,

    Haven't done any PHP really but I made this script over the last couple of days and it has on it a voting system of + / - which orders the list. See below :

    http://www.gtasampserverlist.com

    The problem is that it's easy for anyone to click the vote button over and over again. Is there any way of preventing this so a user/IP/computer can only vote on an entry once every hour or so?

    Thanks
     
    Hecky, Sep 6, 2010 IP
  2. themullet

    themullet Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #2
    could just record the votes in a table and check if person already voted
     
    themullet, Sep 6, 2010 IP
  3. Hecky

    Hecky Like a Dungeon Dragon!

    Messages:
    5,656
    Likes Received:
    284
    Best Answers:
    1
    Trophy Points:
    0
    #3
    There's no account system - people can vote without registering. I guess that would mean recording their IP address. Maybe have a mySQL table with the IP attached to the website they're voting on, and check that when they try to vote as well as wiping it every hour.
     
    Hecky, Sep 6, 2010 IP
  4. themullet

    themullet Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #4
    pretty much, make sure to index it as well. post_id and ip should do what you need
     
    themullet, Sep 6, 2010 IP
  5. Hecky

    Hecky Like a Dungeon Dragon!

    Messages:
    5,656
    Likes Received:
    284
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Works perfectly -- except cPanel wont stop sending me emails telling me every time it's completed a cron job :p
     
    Hecky, Sep 6, 2010 IP