Reputation: 335
I have an application developed in zend framework. The problem is that sessions are not destroyed when the browser window is closed. Any idea?
Upvotes: 1
Views: 2493
Reputation: 419
I got the same problem when I use Zend remember me option and I didn't find the solution but had a good idea, to store sessions using zend db handler and deletes older cookies by writing simple query to Delete expired sessions(if it cron task, that is a good solution).
For more information about zend session db handler you can find here,
http://framework.zend.com/manual/en/zend.session.savehandler.dbtable.html
Upvotes: 0
Reputation: 2821
Ordinarily, sessions end when the user agent terminates, such as when an end user exits a web browser program. However, your application may provide the ability to extend user sessions beyond the lifetime of the client program through the use of persistent cookies.
If you don't use Zend_Session::rememberMe()
, it should be destroyed after you close all windows of browser.
Upvotes: 1
Reputation: 17724
Use the onunload event to send an ajax request to your server that will destroy the session
See : onunload
Upvotes: 1
Reputation: 343
You should set the session.cookie_lifetime to 0 in your php.ini or in your code.
The value 0 means "until the browser is closed."
http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
code:
session_set_cookie_params (0);
Upvotes: 0
Reputation: 82
The session variable wouldn't be destroyed until it expires or you clear the browser cookies. You can see this same problem when we close the browser before logging out.
Upvotes: 0