diff --git a/Admin.php b/Admin.php index f2cbee2..5bd4081 100644 --- a/Admin.php +++ b/Admin.php @@ -1,5 +1,6 @@ $_SESSION['expire']) { + include 'logout.php'; + } +?> diff --git a/Script.php b/Script.php index 68c3b3c..af3b588 100644 --- a/Script.php +++ b/Script.php @@ -75,6 +75,11 @@ if (!empty($_POST["form_signup"])) { $_SESSION['user_email'] = $email; $_SESSION['user_student_id'] = $student_id; + // set session duration + $_SESSION['start'] = time(); + $session_duration = 120; + $_SESSION['expire'] = $_SESSION['start'] + ($session_duration * 60); + // check confirmed password if (strcasecmp($password, $confirmpassword) != 0) { $_SESSION['info_signup'] = "Password confirmation failed."; @@ -162,6 +167,11 @@ if (!empty($_POST["frm_login"])) { $_SESSION['user_type'] = $row['UserType']; $_SESSION['user_fullname'] = $row['Full_Name']; + // set session duration + $_SESSION['start'] = time(); + $session_duration = 120; + $_SESSION['expire'] = $_SESSION['start'] + ($session_duration * 60); + if ($_SESSION['user_type'] == "Student") { header("Location: Courses.php"); }