php - losing cookie after closing the browser -


         $value = array(              'id'       => $data['id'] ,               'username' => $data['username'] ,              'email'    => $data['email'] ,              'last_ip'  => $this->input->ip_address()           );           $value  = serialize($value);           $cookie =  array (              'name'   => 'is_logged' ,              'value'  => $value ,              'expire' => time()+86400 ,           );           set_cookie($cookie); 

i have function checking cookie

function get_k(){     $k = get_cookie('is_logged');      var_dump($k);  } 

this works fine after login while browser still open , if close browser , doesn't work anymore

my config

$config['cookie_prefix']    = ""; $config['cookie_domain']    = ""; $config['cookie_path']      = "/"; $config['cookie_secure']    = false; 

i'm working on localhost/firefox

remove time() 'expire' value, codeigniter adds automatically.

you have stray comma after 'expire'.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -