CodeIgniter Forums
Why does seesion expire too soon? - 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: Why does seesion expire too soon? (/showthread.php?tid=56383)



Why does seesion expire too soon? - El Forum - 12-14-2012

[eluser]behnampmdg3[/eluser]
Hello

Why does the session expire in a few minutes? Sometimes 5 minutes, sometimes 1, sometimes 10? This is how I create it:
Code:
$user_data = array('email'=>$results['email'], 'id'=>$results['id'], 'login'=>true);
$this->session->set_userdata($user_data);

Thanks


Why does seesion expire too soon? - El Forum - 12-14-2012

[eluser]InsiteFX[/eluser]
./application/config/config.php
Code:
$config['sess_expiration']         = 7200;  // Session last 2 hours you can raise it up.
$config['sess_time_to_update'] = 300;   // 300 = 5 minutes to update raise it up to last longer.



Why does seesion expire too soon? - El Forum - 12-15-2012

[eluser]behnampmdg3[/eluser]
[quote author="InsiteFX" date="1355554494"]./application/config/config.php
Code:
$config['sess_expiration']         = 7200;  // Session last 2 hours you can raise it up.
$config['sess_time_to_update'] = 300;   // 300 = 5 minutes to update raise it up to last longer.
[/quote]
I tried this but still logs me out:
Code:
$config['sess_cookie_name']  = 'ci_session';
$config['sess_expiration']  = 14000;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name']  = 'ci_sessions';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 14000;



Why does seesion expire too soon? - El Forum - 12-15-2012

[eluser]InsiteFX[/eluser]
If you are using IE then you need to change this.
Code:
$config['sess_cookie_name']  = 'ci_session';
to
$config['sess_cookie_name']  = 'cisession';

Also IE neeeds to be setup to allow session cookies under tools options.



Why does seesion expire too soon? - El Forum - 12-15-2012

[eluser]behnampmdg3[/eluser]
[quote author="InsiteFX" date="1355559643"]If you are using IE then you need to change this.
Code:
$config['sess_cookie_name']  = 'ci_session';
to
$config['sess_cookie_name']  = 'cisession';

Also IE neeeds to be setup to allow session cookies under tools options.
[/quote]I am updating my code but this is rather strange! I want to make robust code that works on every browser!
Thank you