jeudi 22 juillet 2021

Increase the number for each request sent by Cookie

I want to make a page that checks the login process. If it is repeated more than 5 times requests , the user will be banned by count the Cookie

my code:

<form method="POST">
<input type="text" name="user">
<input type="text" name="pass">
<input type="submit" name="start" value="Login">
</form>
<?php
session_start();
#setcookie("secure", "", 1);
$i=0
if(@$_POST["start"]){
    $i++;
    setcookie('secure', $i, time() + (86400 * 30), "/"); 

        if($_SESSION["secure"] == 5) {
            echo "Banned !";
        } else {
            echo "Number is : ".$_SESSION["secure"];
        }
    
}
?>

Aucun commentaire:

Enregistrer un commentaire