I am creating a simple login page using session and cookie. If the user login on system and if the user don't do anything on the page,it will redirect to login page again after 1 minutes using php What I have tried so far is attached below.
Login.php
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$username = $_POST['uname'];
$password = $_POST['pass'];
if($username == "kobi" && $password == "123"){
$_SESSION["uname"]=$username;
setcookie("user", $username, time() + (60));
header('location:welcome.php');
}
}
?>
welcome.php
<?php
session_start();
echo "User Name " . $_SESSION['uname'] . ".<br>";
?>