HAN! Posted October 30, 2007 Share Posted October 30, 2007 i need logout the user by timeout while he is logeed in, is there any code i can write in my script to do this or i just have to change my php.ini, and how to change my php.ini? thanks Link to comment https://forums.phpfreaks.com/topic/75328-ending-session/ Share on other sites More sharing options...
aschk Posted October 30, 2007 Share Posted October 30, 2007 Session timeout is determined by the settings in your php.ini file. However I believe there is a way to change the session timeout on a per domain basis (for virtual hosts). In PHP you can try ini_set("session.gc_maxlifetime", 60*60); The above sets the timeout to 1 hour. Link to comment https://forums.phpfreaks.com/topic/75328-ending-session/#findComment-381026 Share on other sites More sharing options...
kratsg Posted October 30, 2007 Share Posted October 30, 2007 If you can access the exact time the session was made... <?php $max_time_limit = "3600";//60 minutes $time_left = time() - $session_started; if($time_left >= $max_time_limit){ unset($_SESSION["username"]; unset($_SESSION["other_variable"]; //etc... } ?> Link to comment https://forums.phpfreaks.com/topic/75328-ending-session/#findComment-381048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.