um, I think I agree with what malbera said.
just create a session variable ($_SESSION) and then increment it each time an unsuccesful attempt is made.
Also storing a cookie may also work.
Both can be easily gotten around however.
Storing their IP in a database and using that maybe be better if they have a static IP address.
Sessions start each time the browser is opened on the page, and cookies can be deleted, and IPs may be dynamic 🙂