stuart7398 Posted April 8, 2008 Share Posted April 8, 2008 Hi. Can anybody assist me as to how i automically log a user out after a certain amount of time due to the user being inactive, say after 15 minutes then redirected to the login page with a message. The code would be very helpful. Where do i start? thanks, Stuart. <code> <?php //Start session session_start(); //Check whether the session variable //SESS_MEMBER_ID is present or not if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID'])=='')) { header("location: access-denied.php"); exit(); } ?> </code> Link to comment https://forums.phpfreaks.com/topic/100198-solved-logging-out-after-inactivity/ Share on other sites More sharing options...
discomatt Posted April 8, 2008 Share Posted April 8, 2008 session_cache_expire(30); Sets the session to last for 30 minutes... or at least it should. Remember to call this BEFORE session_start() Link to comment https://forums.phpfreaks.com/topic/100198-solved-logging-out-after-inactivity/#findComment-512332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.