Limit isset post on login form.

I want to limt isset post on login form but am not sure where to begin.

[php]
if{
// this is login successful
}
else {
$login_attempts = isset( $_POST[‘login’] // some sort of php count;
if ($login_attempts >=5) {
// something that I’ll do
}
else
// something that I’ll do if it is <$login_attempts = error wrong password or username try again
}}
[/php]

I only need help with the variable :

[php]
$login_attempts = isset( $_POST[‘login’] // some sort of php count;
[/php]

Any help on this will be, as always, appreciated.

Here’s something else of an attempt :

[php]
$login = $_POST[‘login’];
$login_attempts = count($login,0);
[/php]

Not sure how to set this up.

At this point I’m figuring that I won’t be able to do a count on the post attempts. I’m going to have to do a count on the refresh of the form when submitted, as in counting the amount of times the user request the page and running the script according to that, but I’m not sure. how to count page request using this :

[php]
$_SERVER[‘REMOTE_ADDR’]
[/php]

as the user attempting the login. I’ll continue to look around and see what I can find on this.

You could possibly store a session variable but it is not a reliable option since they could just clear sessions to reset the counter. This would have to be database driven to be secure.

I went with a session variable on this for now as I’m not sure how to approach this correctly on the database side. I do have a database setup which keeps track of all visitors to site :

[php]
date(), $_SERVER[‘REMOTE_ADDR’], $_SERVER[‘HTTP_REFERER’], $_SERVER[‘REQUEST_URI’], $_SERVER[‘HTTP_USER_AGENT’]
[/php]

I’m not sure how to approach a script to count the visitor than add to block list for admin page. For now sessions will work to thwart off the not so savvy on multiple attempts. When I have more time I’ll see what I can come up with on that. If anyone has a suggestion on how to approach this in a script I’d be more than happy to give it a go though. Thanks again m@tt for your help and suggestions. Yet another plus on your karma from me. :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service