Looking for a query limiter script

Discussion in 'PHP' started by picobello, Aug 5, 2007.

  1. #1
    To avoid that a user can query my website (doing POSTs too fast) more than one query every 15 sec

    Any script doing that based on ip?
     
    picobello, Aug 5, 2007 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Record the time the user last POSTed in a session, then check against it to see if he is POSTing too soon?
     
    matthewrobertbell, Aug 5, 2007 IP
  3. picobello

    picobello Well-Known Member

    Messages:
    572
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Yea not bad, thanks Matthew but I guess some scripters could still automate the session handling (ex: using curl) and do lots of queries? Is it not better to only rely on server side countermeasures?
     
    picobello, Aug 5, 2007 IP
  4. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, i suppose a more complex way is to have a database table containing the time last posted, based on the user's ip address.
     
    matthewrobertbell, Aug 5, 2007 IP
  5. picobello

    picobello Well-Known Member

    Messages:
    572
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Don't you know if such read-to-use free snippet exists somewhere?
     
    picobello, Aug 5, 2007 IP
  6. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sorry, no, i tend to just code things myself.
     
    matthewrobertbell, Aug 5, 2007 IP
  7. lggmaster

    lggmaster Peon

    Messages:
    233
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I created a 30 second post limit function using database, fairly easily.

    All it calls for is a simple table recording the user's id and the time of last post using DATETIME. Then, a check when posting that will add however long you want the user to wait between posts, and checking the current time to validate.

    Pre-made forums such as vBulletin and phpBB will be fun to modify. But, you should check the forum's website for an add-on like this.
     
    lggmaster, Aug 5, 2007 IP