Making sessions expire
Posted: Fri Jun 13, 2003 2:21 pm
I have a question about sessions. I am fairly new to PHP and sessions especially, but I have learned enough to make them work and do what I need them to do.
The problem I would like to solve is as follows:
Every time a user logs on to the site I created, a session file is created in which I store some information. Now in order to kill that session a user has to log out, which if they do works fine. But if they do not log out and simply close the browser window, the session file still exists. My question is: Is there a way to make these sessions files "expire" so that they get automatically deleted after a certain period of time, or is it possible to detect when a user is closing the window without loggin out and write the session kill code when that happens?
Thanx
The problem I would like to solve is as follows:
Every time a user logs on to the site I created, a session file is created in which I store some information. Now in order to kill that session a user has to log out, which if they do works fine. But if they do not log out and simply close the browser window, the session file still exists. My question is: Is there a way to make these sessions files "expire" so that they get automatically deleted after a certain period of time, or is it possible to detect when a user is closing the window without loggin out and write the session kill code when that happens?
Thanx