dizzy1 Posted April 3, 2009 Share Posted April 3, 2009 HI, How can I put a 5 minute timer on a session. ive made the session but it i dont know how to put a time on it. session_test('$Username'); $_SESSION[$Username]=$DBusername Link to comment https://forums.phpfreaks.com/topic/152401-php-session/ Share on other sites More sharing options...
Benmcfc Posted April 3, 2009 Share Posted April 3, 2009 You could record the current time as a session variable, and on every subsequent pageload you could check if that time was within 5 minutes of the current time. Link to comment https://forums.phpfreaks.com/topic/152401-php-session/#findComment-800369 Share on other sites More sharing options...
premiso Posted April 3, 2009 Share Posted April 3, 2009 session_cache_expire That would be the function you are after. You will need to place that before the session_start call for it to work. Sorry the above was wrong information. ini_set('session.gc_maxlifetime', 300); session_start(); Where 300 is how long in seconds you want it to live. Place that before the session_start and it should only last as long as you set it to. Link to comment https://forums.phpfreaks.com/topic/152401-php-session/#findComment-800399 Share on other sites More sharing options...
PFMaBiSmAd Posted April 3, 2009 Share Posted April 3, 2009 Someone probably did that to this person to screw him over - http://www.phpfreaks.com/forums/index.php/topic,246085.0.html The only thing session garbage collection should be used for is to remove old session data files. If you want a specific time check on your site, store the last access time and check how long ago it was on each page access and take appropriate action. Link to comment https://forums.phpfreaks.com/topic/152401-php-session/#findComment-800430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.