Page 1 of 1

Destroy session when closing window

Posted: Wed Dec 15, 2004 5:49 am
by snicolas
Is that possible without closing all windows?
Any help will be appreciated.
I just need to call my Logout(0 scripot when a user close the Explorer window.

s

Posted: Wed Dec 15, 2004 7:10 am
by snicolas
anybody on this?

Posted: Wed Dec 15, 2004 12:22 pm
by Archy

Code: Select all

<?PHP
session_start();
// Next line is optional, it is not neccesary
session_unset();
session_destroy();
...
...
?>

Posted: Wed Dec 15, 2004 1:47 pm
by AGISB
In case any of the windows stays open you have a problem as there is no way to determine if the window is still open as this is on the client side.

However the approach to solve this is called garbage collection. You update a timestamp database file including ip and sessionid each time the user does a site call. If there was no site call in a defined timeframe the entry is invalid and a relogin has to be done no matter if any windows are still open or not.