Solarpitch Posted August 7, 2008 Share Posted August 7, 2008 Hi, This has probably been asked alot... but can anyone point me in the right direction to setting the duration of a session after it is registered. I have a session called ADMIN_LOGIN which I want to set for 20 min then expire. Thanks Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/ Share on other sites More sharing options...
DarkWater Posted August 7, 2008 Share Posted August 7, 2008 Is that the name of a separate session, or just a session variable? o-O Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610769 Share on other sites More sharing options...
Solarpitch Posted August 7, 2008 Author Share Posted August 7, 2008 Session Variable. Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610785 Share on other sites More sharing options...
mikeschroeder Posted August 7, 2008 Share Posted August 7, 2008 Are you trying to expire all session variables, or just the $_SESSION['ADMIN_LOGIN'] value? Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610814 Share on other sites More sharing options...
DarkWater Posted August 7, 2008 Share Posted August 7, 2008 Just do: $_SESSION['ADMIN_LOGIN'] = time(); Then on pages that require it, do: if ($_SESSION['ADMIN_LOGIN'] && (($_SESSION['ADMIN_LOGIN'] + (60*60*20)) > time()) { } Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610816 Share on other sites More sharing options...
mikeschroeder Posted August 7, 2008 Share Posted August 7, 2008 Just do: $_SESSION['ADMIN_LOGIN'] = time(); Then on pages that require it, do: if ($_SESSION['ADMIN_LOGIN'] && (($_SESSION['ADMIN_LOGIN'] + (60*60*20)) > time()) { } 60*60*20 = 20 hours 60 * 20 = 20 mins Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610835 Share on other sites More sharing options...
DarkWater Posted August 7, 2008 Share Posted August 7, 2008 Yeah I know, I realized that afterwards. =P Thanks. Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610838 Share on other sites More sharing options...
Solarpitch Posted August 7, 2008 Author Share Posted August 7, 2008 Thanks guys... I'll try that out! Link to comment https://forums.phpfreaks.com/topic/118640-setting-the-duration-of-a-session/#findComment-610852 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.