I have included a zip file with the login system I am using.
I have tried to put it in the functions.php file, but it does nothing.
This is really etching my head.😕
//New 3/30/2013 - Function that locks the account out after 3 attempts
function lockout($user_id)
{
/*
This will lock out after 3 invalid logins It will flag the Locked tag so then when login is attempted It will give the friendly
Error that tells them that there account is locked and someone will get there account back up and running shortly
*/
$database = mysql_connect("localhost","myadmin","mypass");
mysql_select_db("weblogin",$database);
$query = "SELECT * FROM authorize where username = '$user_id'";
$results = mysql_query($query);
$num = mysql_num_rows($results);
if ($num=="0")
{
$sqlq="INSERT INTO authorize values('','','$user_id','','','','','','','','','','','')";
mysql_query($sqlq,$database);
}else{
while($row = mysql_fetch_array($results))
{
$times = $row["times"];
$i = $times ; $i++;
$sqlq = "UPDATE authorize SET times='$i' WHERE username='$user_id'";
$done = mysql_query($sqlq);
}
}
$attempt = $i;
if ($attempt == "3")
{
$lock = "yes";
$sqlq = "UPDATE authorize SET locked='$lock' WHERE username='$user_id'";
$results = mysql_query($sqlq,$database);
print "You have entered an invalid password three times. We have locked your account for security reasons.";
print "\n An email was sent to the site administrator he will evaluate the activity of your account and will\n";
print "then choose if he will re-activate your account. They may have some questions to ask you so please be on";
print "the look out for an email from <a href=mailto:admin@before-ipo.com>admin@before-ipo.com</a>";
print "<BR><BR><BR>We are sorry for the inconvience";
}else{
$sqlq = "UPDATE authorize SET times='$i' WHERE username='$user_id'";
$results = mysql_query($sqlq,$database);
}
return true;
}
loginsystem.zip