I\'m looking for the most elegant way to lock a Django user account after several failed login attempts.
\"What have I tried?\":
You can try this snippet:
=3){
echo " you have to wait for sometimes to enable your login"."
";
}
if(isset($_POST["username"],$_POST["userpassword"])){
$username = $_POST['username'];
$userpassword = $_POST['userpassword'];
$query = "SELECT * from userlogin where username='".$username."' and userpassword='".$userpassword."'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
if($row){
echo"login successfull";
}
else{
echo"Invalid password"."
";
if(isset($_COOKIE['login'])){
$attempts=$_COOKIE['login']+1;
}else{
$attempts=1;
}
setcookie('login', $attempts, time()+60*60);
}
}
?>