When you go to this page; http://www.ctuchicago.com/registration/login.php
you will see the form that I made. I want to create a session if username and password is true than I wanna set a 20 minutes expire time for it. How can I do it ?
my check.php
$user = $_POST['user'];
$pass = $_POST['pass'];
$ruser = "a";
$rpass = "b";
if ($user == $ruser) {
 $logn = "True"; 
} else {
 $logn = "False";  
}
if ($pass == $rpass) {
 $logs = "True"; 
} else {
 $logs = "False";  
}
 if ($logn == "False" && $logs == "False") {
 echo '<script type="text/javascript">alert("The Username and The Password are both wrong ! Please check your information and try again.");history.go(-1);</script>';
 } elseif ($logn == "True" && $logs == "False") {
 echo '<script type="text/javascript">alert("The Username is True but something is wrong with the password you entered. Please check your information and try again.");history.go(-1);</script>';
 } elseif ($logn == "False" && $logs == "True") {
 echo '<script type="text/javascript">alert("The Password is True but something is wrong with the password you entered. Please check your information and try again.");history.go(-1);</script>';
 } else {
 $_SESSION['valid'] = "1";
 echo '<script type="text/javascript">window.location = "http://www.ctuchicago.com/registration"</script>';
 }
my index.php (this page I want to be login required.
    if ($_SESSION['valid']) {
 echo '<script type="text/javascript">window.location = "http://www.ctuchicago.com/registration/login.php"</script>';
} else { Code }
Thank You
 
     
     
     
    