I have a piece of code below where session variables can last for 12 hours:
ini_set('session.gc_maxlifetime',12*60*60);
ini_set('session.gc_divisor', '1');
ini_set('session.gc_probability', '1');
ini_set('session.cookie_lifetime', '0');
But what my question is that is it possible to log the user out once 12 hours has passed and the session variables have expired? In other words I have a teacherlogout.php page, after 12 hours has passed can it redirect the user to the logout page once the user has navigated to another page or refreshed the page after 12 hours?
UPDATE:
Could this work:
if ((isset($username)) && (isset($userid))){
...//WHOLE CODE
}else{
header( 'Location: teacherlogout.php' ) ;
}