P5system Posted March 7, 2013 Share Posted March 7, 2013 Hi< I am running a script in php I want the user logout when they close the browser? Any help will be appreciated Link to comment https://forums.phpfreaks.com/topic/275348-auto-logout-after-browser-is-closed-in-php/ Share on other sites More sharing options...
teynon Posted March 7, 2013 Share Posted March 7, 2013 If your using sessions, they should expire when the browser is closed, depending on your settings. Link to comment https://forums.phpfreaks.com/topic/275348-auto-logout-after-browser-is-closed-in-php/#findComment-1417121 Share on other sites More sharing options...
Shadowing Posted March 7, 2013 Share Posted March 7, 2013 If you are using cookies its impossible Link to comment https://forums.phpfreaks.com/topic/275348-auto-logout-after-browser-is-closed-in-php/#findComment-1417133 Share on other sites More sharing options...
teynon Posted March 7, 2013 Share Posted March 7, 2013 Sessions use cookies. The cookie setter can specify a deletion date, in which case the cookie will be removed on that date. If the cookie setter does not specify a date, the cookie is removed once the user quits his or her browser. http://en.wikipedia.org/wiki/HTTP_cookie#Implementation Link to comment https://forums.phpfreaks.com/topic/275348-auto-logout-after-browser-is-closed-in-php/#findComment-1417135 Share on other sites More sharing options...
ShoeLace1291 Posted March 7, 2013 Share Posted March 7, 2013 A more clarifying statement: Sessions are a simple way to store data for individual users against a unique session ID. This can be used to persist state information between page requests. Session IDs are normally sent to the browser via session cookies and the ID is used to retrieve existing session data. The absence of an ID or session cookie lets PHP know to create a new session, and generate a new session ID. http://www.php.net/manual/en/session.examples.basic.php Link to comment https://forums.phpfreaks.com/topic/275348-auto-logout-after-browser-is-closed-in-php/#findComment-1417137 Share on other sites More sharing options...
P5system Posted March 12, 2013 Author Share Posted March 12, 2013 Thank you all Link to comment https://forums.phpfreaks.com/topic/275348-auto-logout-after-browser-is-closed-in-php/#findComment-1418102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.