[eluser]jvicab[/eluser]
Hi everyone:
Problem: I am not getting the values that are suppossed to be stored on cookies.
Notes:
- I am using CI session stored in the DB (settings in config.php):
Code:
$config['sess_cookie_name'] = 'session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = true;
$config['sess_encrypt_cookie'] = true;
$config['sess_use_database'] = true;
$config['sess_table_name'] = 'sessions';
- I have a commom controller from which all my controllers inherit.
Logic:
I am setting two cookies in my login function (with native setcookie php function) to store email and password values if the checkbox "remember me" in the login form is checked.
Code:
$email = $this->input->post('email');
$password = $this->input->post('usrpass');
if ($this->input->post('RememberMe') !== false) {
setcookie('rmemail', $email, time() + 31536000); // one year expiration
setcookie('rmpswd', $password, time() + 31536000);
} else {
//destroy cookies:
setcookie('rmemail', '', time() - 3600);
setcookie('rmpswd', '', time() - 3600);
}
- I checked that I am getting values for $email, $password and the if is already entering in its "true" section.
I read those cookies in my common controller but they are always empty.
Code:
$this->RememberedEmail = $this->input->cookie('rmemail');
$this->RememberedPswd = $this->input->cookie('rmpswd');
Any idea why?
Thanks in advance for the help.