Codeigniter Cookies Help Codeigniter Cookies Help codeigniter codeigniter

Codeigniter Cookies Help


Using the cookie helper, you could check if a user is a first time visitor by doing:

if (!get_cookie('some_value')) {    // cookie not set, first visit    // create cookie to avoid hitting this case again    $cookie = array(        'name'   => 'some_value',        'value'  => 'The Value',        'expire' => time()+86500,        'domain' => '.some-domain.com',        'path'   => '/',        'prefix' => '',    );    set_cookie($cookie);}


Anyone else finding odd results when using codeignighters cookies be sure that the cookie was set using codeignighters $this->input->set_cookie instead of PHP's own setcookie method.

I had strange results until I clear all cookies and reset it with codeignighters own method.