title: Quick and easy flood protection?
body: <p>I have a site where a user submits a message using AJAX to a file called <code>like.php</code>. In this file the users message is submitted to a database and it then sends a link back to the user. In my Javascript code I disabled the text box the user types into when they submit the AJAX request.</p>
  
  <p>The only problem is, a malicious user can just constantly send POST requests to <code>like.php</code> and flood my database. So I would like to implement simple flood protection.</p>
  
  <p>I don't really want the hassle of another database table logging users IPs and such... as if they are flooding my site there will be a lot of database read/writes slowing it down. I thought about using sessions, like have a session that contains a timestamp that gets checked every time they send data to <code>like.php</code>, and if the current time is before the timestamp let them add data to the database, otherwise send out an error and block them. If they are allowed to enter something into the database, update their session with a new timestamp.</p>
  
  <p>What do you think? Would this be the best way to go about it or are there easier alternatives?</p>
  
  <p>Thanks for any help. :)</p>