<html>
<head>
</head>
<body>
<div align=center>
Login
<form name="form1" method="post" action="b.php">
<div align="center">
<table border="1">
<tr>
<td width="120">Username :</td>
<td width="144"><input name="user" type="text" id="user"></td>
</tr>
<tr>
<td width="120">Mot de passe : </td>
<td width="144"><input name="password" type="text" id="password"></td>
</tr>
</table>
</div>
<p align="center">
<input type="submit" name="Submit" value="Enter">
</p>
</form>
</body>
</html>
file b.php
<?php
$val='1';
setcookie("attempts",$val);
//session_start();
echo "<meta charset=UTF-8>";
if(isset($_POST["user"])&& isset($_POST["password"])&&isset($_COOKIE["attempts"])){
if(($_POST["user"]=="admin")&&($_POST["password"]=="enter12")&&($_COOKIE["attempts"]))
{
setcookie("attempts",1,time()+60*60*24);
echo "Welcome <b>".$_POST["user"]."</b> !<br/>";
}
}
else
{
setCookie("attempts",$_COOKIE["attempts"]+1);
echo "Failed,bad username or password. ".$_COOKIE["attempts"]." attempt to log in.";
}
if($_COOKIE["attempts"]==3){
setcookie("attempts",0,time()+300);
return true;
}
?>
I think I need to use another setcookie for the time that the user will be lock out of site for 10 minutes.
I just can't figure out how to to lock the page from the user for a limited time periode.
Can someone help me.
thanks