I am trying to have a remember me feature in CodeIgniter. My issue is that after 2 hours or so, my sessions are expiring.
I have tried using:
$remember = $this->input->post('remember_me');
if($remember) {
$this->session->sess_expiration = '1209600';
}
And I am suspecting its because of:
$config['sess_expiration'] = 7200;
in config.php
. Maybe it's overriding the maximum session time. Any help on this will be appreciated.
Did you try like this...
$remember = $this->input->post('remember_me');
if($remember) {
$this->session->sess_expiration = '1209600';
$this->config->set_item('sess_expiration', 1209600);
}
If you would like to dynamically set a config item or change an existing one, you can do so using:
$this->config->set_item('item_name', 'item_value');
See more here...https://www.codeigniter.com/userguide3/libraries/config.html