I have a login/registration script and I want to put this code in it that when users enter their wrong login info 3 or more times it will lock them out for however many minutes.
Heres is the website that has the code:
And help me with the Mysql part and php part codes
http://xlinesoft.com/articles/system_access_lock.htm
So after 3 or more failed login attempts it will lock them out from the login page.
So I'm assuming you will need to look at the php code of My login page:
-Login.php-
<?php # Script 16.8 - login.php
// This is the login page for the site.
require_once ('includes/config.inc.php');
$page_title = 'Login';
include ('includes/header.html');
if (isset($_POST['submitted'])) {
require_once (MYSQL);
// Validate the email address:
if (!empty($_POST['email'])) {
$e = mysqli_real_escape_string ($dbc, $_POST['email']);
} else {
$e = FALSE;
echo '<p class="error">You Forgot To Enter Your Email Address!</p>';
}
// Validate the password:
if (!empty($_POST['pass'])) {
$p = mysqli_real_escape_string ($dbc, $_POST['pass']);
} else {
$p = FALSE;
echo '<p class="error">You Forgot To Enter Your Password!</p>';
}
if ($e && $p) { // If everything's OK.
// Query the database:
$q = "SELECT user_id, first_name, user_level FROM users WHERE (email='$e' AND pass=SHA1('$p')) AND active IS NULL";
$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));
if (@mysqli_num_rows($r) == 1) { // A match was made.
// Register the values & redirect:
$_SESSION = mysqli_fetch_array ($r, MYSQLI_ASSOC);
mysqli_free_result($r);
mysqli_close($dbc);
$url = BASE_URL . 'index.php'; // Define the URL:
ob_end_clean(); // Delete the buffer.
header("Location: $url");
exit(); // Quit the script.
} else { // No match was made.
echo '<p class="error">Either The Email Address And Password Entered Do Not Match Those On File or You Have Not Yet Activated Your Account.</p>';
}
} else { // If everything wasn't OK.
echo '<p class="error">Please Try Again.</p>';
}
mysqli_close($dbc);
} // End of SUBMIT conditional.
?>
<h1><img src="Login Icon.png" width="135" height="129"></h1>
<p><font color="green">Your Browser Must Allow Cookies In Order To Log In</font></p>
<form action="login.php" method="post">
<fieldset>
<p><b>Email Address:</b> <input type="text" name="email" size="20" maxlength="40" /></p>
<p><b>Password:</b> <input type="password" name="pass" size="20" maxlength="20" /></p>
<div align="left"><input type="submit" name="submit" value="Login" /></div>
<input type="hidden" name="submitted" value="TRUE" />
</fieldset>
</form>
<?php // Include the HTML footer.
include ('includes/footer.html');
?>
And I Appreciate Anybody who helps me with this, Thank you