Welcome Guest, Not a member yet? Register   Sign In
sess_expire_on_close
#8

(02-16-2016, 01:14 PM)jlamim Wrote: sess_expiration = 0 not working.

My config:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I need destroy session when user close window.

That's not how it works.

The event of a browser being closed is undetectable - you don't know if/when that happens and therefore it cannot trigger anything on the server side (meaning it can't effectively destroy the session). Instead, by setting a cookie's expiration time to 0, you tell the browser to only save the cookie in memory and thus not preserve it for the next time it runs. That way the user loses their session ID and cannot link to the same session.
However, the session data itself still exists on the server for some time, until the garbage collector runs and deletes all session files that have been inactive for more than ini_get('session.gc_maxlifetime') seconds.

Also, don't leave sess_save_path empty - you are required to configure that.
Reply


Messages In This Thread
sess_expire_on_close - by rolly - 12-06-2015, 02:38 AM
RE: sess_expire_on_close - by InsiteFX - 12-06-2015, 04:23 AM
RE: sess_expire_on_close - by Narf - 12-07-2015, 04:13 AM
RE: sess_expire_on_close - by rolly - 12-07-2015, 07:39 AM
RE: sess_expire_on_close - by rolly - 12-07-2015, 07:43 AM
RE: sess_expire_on_close - by PaulD - 12-07-2015, 03:23 PM
RE: sess_expire_on_close - by jlamim - 02-16-2016, 01:14 PM
RE: sess_expire_on_close - by Narf - 02-16-2016, 02:46 PM
RE: sess_expire_on_close - by Nabanita - 04-04-2016, 02:35 AM
RE: sess_expire_on_close - by PaulD - 04-04-2016, 05:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB