title: How to prevent brute force attacks on ajax form submission?
body: <p>Suppose I have the file <code>login.php</code>.</p>
  
  <p><code>login.php</code> takes get (or post) parameters username and password and return true if login successful and false otherwise. This way other pages can access it via ajax.</p>
  
  <p>My question is, since this method is vulnerable to brute force attacks, how should I secure this. I'm thinking of making it refuse access unless it is from my own site's form, but how would you go about doing that?</p>
  
  <p>I use jquery to make ajax calls.</p>