I use this function to add cookie and it adds perfectly as I can see in browser options.
function login($username,$password){
$cookieUsername = array(
'name' => 'user',
'value' => md5($username),
'expire' => time()+1000,
'path' => '/',
'secure' => TRUE
);
$cookiePassword = array(
'name' => 'pass',
'value' => $password,
'expire' => time()+1000,
'path' => '/',
'secure' => TRUE
);
$this->input->set_cookie($cookieUsername);
$this->input->set_cookie($cookiePassword);
}
I am unable to get back the cookie from this function:
echo $this->input->cookie('user');
Please help - how can I get cookie back from CodeIgniter?
set_cookie
andcookie
calls are in different http request? I mean browser after you call set-cookie you can not get it unless its sent to browser and browser makes the next request. – Unburden