MortimerJazz Posted December 18, 2006 Share Posted December 18, 2006 Can someone explain to me how you do this?Basically, I want to ensure that if someone logs in and then leaves the computer for say 20 minutes, the session automatically ends and a user is forced to log in again.Thanks alot,morty Link to comment https://forums.phpfreaks.com/topic/31124-setting-timeouts-for-sessions/ Share on other sites More sharing options...
Orio Posted December 18, 2006 Share Posted December 18, 2006 It is set in your php.ini, the directive is called "session.gc_maxlifetime". Set it to the number of seconds you want it to be in your php.ini file, or use [url=http://www.php.net/ini-set]ini_set("session.gc_maxlifetime", $number_of_secs)[/url] to do so.Orio. Link to comment https://forums.phpfreaks.com/topic/31124-setting-timeouts-for-sessions/#findComment-143744 Share on other sites More sharing options...
MortimerJazz Posted December 18, 2006 Author Share Posted December 18, 2006 So it's something that I need to get my host to change then? Link to comment https://forums.phpfreaks.com/topic/31124-setting-timeouts-for-sessions/#findComment-143749 Share on other sites More sharing options...
wildteen88 Posted December 18, 2006 Share Posted December 18, 2006 No, you can change it yourself. Orio has provided the code for your which is this:[code]ini_set("session.gc_maxlifetime", number_of_secs)[/code]That will be needed to be added to every page that uses sessions.Or if your account allows the use of .htaccess files then you can the following into a .htaccess file:[code]php_value session.gc_maxlifetime "number of secs"[/code] Link to comment https://forums.phpfreaks.com/topic/31124-setting-timeouts-for-sessions/#findComment-143780 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.