Jump to content

session


pranshu82202

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/246569-session/#findComment-1266132
Share on other sites

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.....

Link to comment
https://forums.phpfreaks.com/topic/246569-session/#findComment-1266136
Share on other sites

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);
}

 

Link to comment
https://forums.phpfreaks.com/topic/246569-session/#findComment-1266176
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.