title: Session expired after refresh using Codeigniter
body: <p>I'm trying to save my session, it expired after refreshing the page.</p>
  
  <p>In my controller:</p>
  
  <pre><code> if($u_id){
                  $data=  array(
                      'id'=&gt;$u_id['id'],
                      'user_name'=&gt;$u_id['user_name'],
                      'password'=&gt;$password,
  
                  );
  
                  $this-&gt;session-&gt;set_userdata('logged_in',$data);
                  $this-&gt;session-&gt;set_flashdata('login_succeed','Logged in Successfully');
                  redirect('home/homepage');
              }
  </code></pre>
  
  <p>And in my homepage view:</p>
  
  <pre><code>if (isset($this-&gt;session-&gt;userdata['logged_in'])){
                          echo $this-&gt;session-&gt;userdata['logged_in']['user_name'];}
  </code></pre>
  
  <p>My config:</p>
  
  <pre><code>$config['sess_driver'] = 'files';
  $config['sess_cookie_name'] = 'ci_session';
  $config['sess_expiration'] = 7200;
  $config['sess_save_path'] = NULL;
  $config['sess_match_ip'] = FALSE;
  $config['sess_time_to_update'] = 300;
  $config['sess_regenerate_destroy'] = FALSE;
  </code></pre>
  
  <p>First time when redirect me to homepage, the session is correct and it gave me the username perfectly, but when I refresh the page, the session expired and redirect me to login page. Should I do something in construct or what can I do? please help! I'm using codeigniter</p>