L
LLP-UK
Guest
Hi every1
i have created simple login form with php NO MYSQL - and now i want to Set cookie for this login form, so when the user login they have certain amount of time to back to the page and still be loged in.
so if the user loged in to( login.php ) and left the page and back after 10min still be loged in but if not returned within 10min, he/she should re-enter the username and password!!
this is my code; please have a look,
<html>
<body>
<form action="login.php" method="post">
Username:<input type="text" name="username"><br>
Password:<input type="password" name="password"><br>
<input type="submit" value="Login">
</form>
<?php
if(isset($user)) {
setcookie("username",$user);
setcookie("username", "$user", time() + (60));
}
$user = $_POST["username"];
$pass = $_POST["password"];
$submit = $_POST['submit'];
if ($pass == "password" && $user == "hello"){
echo "Welcome | $user";
}
?>
</body>
</html>
i have created simple login form with php NO MYSQL - and now i want to Set cookie for this login form, so when the user login they have certain amount of time to back to the page and still be loged in.
so if the user loged in to( login.php ) and left the page and back after 10min still be loged in but if not returned within 10min, he/she should re-enter the username and password!!
this is my code; please have a look,
<html>
<body>
<form action="login.php" method="post">
Username:<input type="text" name="username"><br>
Password:<input type="password" name="password"><br>
<input type="submit" value="Login">
</form>
<?php
if(isset($user)) {
setcookie("username",$user);
setcookie("username", "$user", time() + (60));
}
$user = $_POST["username"];
$pass = $_POST["password"];
$submit = $_POST['submit'];
if ($pass == "password" && $user == "hello"){
echo "Welcome | $user";
}
?>
</body>
</html>