pranshu82202 Posted September 6, 2011 Share Posted September 6, 2011 If i use session in my php code then for how much time the session will be valid... And how can i change the length of the session... Quote Link to comment https://forums.phpfreaks.com/topic/246569-session/ Share on other sites More sharing options...
voip03 Posted September 6, 2011 Share Posted September 6, 2011 session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions. http://php.net/manual/en/book.session.php Basic PHP Sessions http://php.about.com/od/advancedphp/ss/php_sessions.htm session_destroy http://php.net/manual/en/function.session-destroy.php Quote Link to comment https://forums.phpfreaks.com/topic/246569-session/#findComment-1266132 Share on other sites More sharing options...
pranshu82202 Posted September 6, 2011 Author Share Posted September 6, 2011 Yeah thats true.. whenever user leaves the site the session expires.... But what if the user opened the website and leave it... then for how much time session will be valid.... And how can i change its time.... that after 5 min when user will refreshed he logged in will he will be logged out..... Quote Link to comment https://forums.phpfreaks.com/topic/246569-session/#findComment-1266136 Share on other sites More sharing options...
voip03 Posted September 6, 2011 Share Posted September 6, 2011 You can set the set timeout period then destroy the session. Quote Link to comment https://forums.phpfreaks.com/topic/246569-session/#findComment-1266138 Share on other sites More sharing options...
WebStyles Posted September 6, 2011 Share Posted September 6, 2011 You can also delete the actual session file if you know exactly where it is (you can set the path where the session files are stored in php.ini). I use this on my intranets when I want to force a user to be logged out. when they login I store their session id: session_start(); $sid = 'sess_'.session_id(); and to force logout I use something like this: $file = '/phpsessions/'.$sid; if(is_file($file)){ unlink($file); } Quote Link to comment https://forums.phpfreaks.com/topic/246569-session/#findComment-1266176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.