How can I set a certain time to destroy a session? Can anyone show me the right way to destroy session after 10 minutes? Here is my code:
Session authorization:
session_start();
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
header("location: index.php");
exit();
}
Session logout:
session_start();
unset($_SESSION['SESS_MEMBER_ID']);
unset($_SESSION['SESS_FIRST_NAME']);
unset($_SESSION['SESS_LAST_NAME']);
header("location: index.php");
Session login:
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['id'];
$_SESSION['SESS_USER_ID'] = $member['username'];
$_SESSION['SESS_FIRST_NAME'] = $member['first_name'];
$_SESSION['SESS_LAST_NAME'] = $member['last_name'];
$_SESSION['SESS_USER_TYPE'] = $member['acc_type'];
session_write_close();
header("location: user_profile.php");
exit();
} else {
header("location: loginerr.php");
exit();
}
} else {
die("Query failed");
}