title: Retrieving session data within Codeigniter
body: <p>I am creating an application which requires a login. The user is able to login, and the application will identify if the user has entered the correct credentials. From here the user will be presented with a dashboard containing information specific to them.</p>
  
  <p>Once a user has entered the correct details, the following code executes:</p>
  
  <pre><code>$this-&gt;load-&gt;library('session');
  $this-&gt;session-&gt;set_userdata('logged_in', true);
  redirect('dashboard', 'refresh');
  </code></pre>
  
  <p>The application will direct the user to the correct location, which contains the following code:</p>
  
  <pre><code>$this-&gt;load-&gt;library('session');
  print_r($this-&gt;session-&gt;all_userdata());
  </code></pre>
  
  <p>This will display the standard session information (session_id, ip_address etc.), but the data in which I stored is not shown.</p>
  
  <p>How do I go about fixing this so that this session data is accessible on every page?</p>
  
  <p>Any help would be greatly appreciated. </p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Here are the current settings for sessions/cookies in config.php:</p>
  
  <pre><code>$config['sess_cookie_name']     = 'ci_session';
  $config['sess_expiration']      = 7200;
  $config['sess_expire_on_close'] = FALSE;
  $config['sess_encrypt_cookie']  = TRUE;
  $config['sess_use_database']    = TRUE;
  $config['sess_table_name']      = 'ci_sessions';
  $config['sess_match_ip']        = FALSE;
  $config['sess_match_useragent'] = TRUE;
  $config['sess_time_to_update']  = 300;
  $config['cookie_prefix']    = "";
  $config['cookie_domain']    = "";
  $config['cookie_path']      = "/";
  $config['cookie_secure']    = FALSE;
  </code></pre>