[eluser]Clooner[/eluser]
I'm trying to save some data as a session with the session class but with every page refresh the data gets lost.
Code:
$this->data['basket_key']=$this->session->userdata('basket_key');
if (!$this->data['basket_key'])
{
$this->data['basket_key']=uniqid();
$this->session->set_userdata('basket_key',$this->data['basket_key']);
}
And this is my config
Code:
$config['cookie_path'] = "/";
$config['cookie_domain'] = str_replace('/','',str_replace('http://',"",$config['base_url']));
$config['cookie_prefix'] = "InScortaC_";
$config['sess_cookie_name'] = 'inscorta_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 0;
I don't see a reason for the sessions getting lost. The value "basket_key" gets regenerated every page refresh but I should remember it. I have the feeling I'm using the session class in a wrong way but in any case I'm a bit lost on what is going on here.