Question

I have a controller method:

class Promoter extends CI_Controller
{
  function __construct()
  {
    parent::__construct();
    var_dump($this->session->all_userdata()); die;

  }

And this keeps outputting different information each time. Shouldn't the session_id be the same no matter how many times I reload the page? Why is it so different?

This is CodeIgniter 2.x btw and my config.php has:

$config['sess_cookie_name']     = 'mycookie';
$config['sess_expiration']      = -1;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update']  = 30;
Was it helpful?

Solution

It's because you set the session expiration at -1. So it expires on refresh.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top