How can I throttle user login attempts in PHP

Posted by jasondavis on Stack Overflow See other posts from Stack Overflow or by jasondavis
Published on 2010-01-19T03:42:08Z Indexed on 2010/05/13 10:04 UTC
Read the original article Hit count: 329

I was just reading this post http://stackoverflow.com/questions/549/the-definitive-guide-to-website-authentication-beta#477585 on Preventing Rapid-Fire Login Attempts.

Best practice #1: A short time delay that increases with the number of failed attempts, like:

1 failed attempt = no delay
2 failed attempts = 2 sec delay
3 failed attempts = 4 sec delay
4 failed attempts = 8 sec delay
5 failed attempts = 16 sec delay
etc.

DoS attacking this scheme would be very impractical, but on the other hand, potentially devastating, since the delay increases exponentially.

I am curious how I could implement something like this for my login system in PHP?

© Stack Overflow or respective owner

Related posts about php

Related posts about Throttling