CodeIgniter Forums
Configuring the session to die on browser close OR live 1800 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Configuring the session to die on browser close OR live 1800 (/showthread.php?tid=27413)



Configuring the session to die on browser close OR live 1800 - El Forum - 02-09-2010

[eluser]tobefound[/eluser]
Hi,

I have this in my config.php:

Code:
$config['sess_cookie_name']   = 'ci_session';
$config['sess_expiration']    = 7200;
$config['sess_encrypt_cookie']  = TRUE;
$config['sess_use_database']  = TRUE;
$config['sess_table_name']    = 'ci_sessions';
$config['sess_match_ip']    = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

The way I understand things, CI can never expire a session (deleting the session cookie is sufficient) because setting 'sess_expiration' to 0 means 'live for 2 years'. Weird...

A common scenario would be to expire a session after say 1800 seconds (half hour) OR expire when the browser closes. How can such a goal be achieved?

/Tommy