4
I’m using Codeigniter to develop a project that involves a restricted area.
I am using session to store user data that is logged in.
I need this information to be deleted when closing the browser, remembering that I am using Codeigniter version 3.1.6 sessions.
Example of how I created the sessions:
$this->session->set_userdata('associated_hash', $userData[0]->hash);
How I’m reading the session:
public function index() {
if (!isset($this->session->associated_hash) || empty($this->session->associated_hash)) {
redirect('login');
}
...
}
How I am doing session deletion while logging in by button:
$this->session->unset_userdata('associated_hash');
My config.php configuration:
$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;
Edit with constructor check:
public function __construct() {
parent::__construct();
if (!isset($this->session->associated_hash) || empty($this->session->associated_hash)) {
redirect('login');
}
}
Questions: When you have the session deleted, does it delete and therefore not enter the restricted pages ? and When you close the browser still persists the session, yes or no? Like I’m asking you because it’s your local problem and I’m trying to figure it out!?!?
– novic
– Bernardo Kowacic
is something local... it is difficult to reproduce, I say this because what has to be done in the documentation reports! and has no other option...
– novic
I came to the conclusion that it is a bug q happens in Ubuntu’s Firefox. I tested in Chrome on Ubuntu and Chrome and Firefox on Windows.
– Bernardo Kowacic