title: CodeIgniter 3.0.3 ci_session not saving session data to ci_sesstion table
body: <p>I'm new to CodeIgniter and I'm having some issues with the login \ logout ci_session data now saving at all. I have setup the standard ci_session table using the script in the CodeIgniter docs and have setup the config file to allow session to be stored in the relevant table, but nothing is.</p>
  
  <p>config.php settinh for sessions:</p>
  
  <pre><code>$config['sess_driver'] = 'files';
  $config['sess_cookie_name'] = 'ci_session';
  $config['sess_encrypt_cookie'] = TRUE;
  $config['sess_use_database'] = TRUE;
  $config['sess_expire_on_close'] = TRUE;
  $config['sess_table_name'] = 'ci_session';
  $config['sess_expiration'] = 60 * 30;
  $config['sess_save_path'] = NULL;
  $config['sess_match_ip'] = FALSE;
  $config['sess_match_useragent'] = TRUE;
  $config['sess_time_to_update'] = 300;
  $config['sess_regenerate_destroy'] = TRUE;
  </code></pre>
  
  <p>Here are the login form MVC files:</p>
  
  <p>MODEL LOGIN</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  class login_model extends CI_Model
  {
       function __construct()
       {
            // Call the Model constructor
            parent::__construct();
       }
       //get the username &amp; password from tbl_usrs
       function get_user($username, $password)
       {
            $this-&gt;db-&gt;where('username', $username);
            $this-&gt;db-&gt;where('password', sha1($password));
            $query = $this-&gt;db-&gt;get('tbl_users');
            return $query-&gt;num_rows();
       }   
  }
  </code></pre>
  
  <p>VIEW LOGIN</p>
  
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed'); ?&gt;
  &lt;div class="container"&gt;
        &lt;div class="col-xs-12 col-sm-9 col-md-9 col-lg-9"&gt;
            &lt;div class="well col-xs-12 col-sm-12 col-md-12 col-lg-10"&gt;
            &lt;?php 
            $attributes = array("class" =&gt; "form-horizontal", "id" =&gt; "loginform", "name" =&gt; "loginform");
            echo form_open("account/login/", $attributes);?&gt;
            &lt;?php echo $this-&gt;session-&gt;flashdata('msg'); ?&gt;
            &lt;fieldset&gt;
              &lt;legend&gt;Login&lt;/legend&gt;
              &lt;div class="form-group"&gt;
                  &lt;div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"&gt;
                      &lt;label for="txt_username" class="control-label"&gt;Username&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"&gt;
                      &lt;input class="form-control" id="txt_username" name="txt_username" placeholder="Please enter your username here." type="text" value="&lt;?php echo set_value('txt_username'); ?&gt;" /&gt;
                      &lt;span class="text-danger"&gt;&lt;?php echo form_error('txt_username'); ?&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"&gt;
                      &lt;label for="txt_password" class="control-label"&gt;Password&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"&gt;
                      &lt;input class="form-control" id="txt_password" name="txt_password" placeholder="Please enter your password here." type="password" value="&lt;?php echo set_value('txt_password'); ?&gt;" /&gt;
                      &lt;span class="text-danger"&gt;&lt;?php echo form_error('txt_password'); ?&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
  
              &lt;div class="form-group"&gt;
                    &lt;div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"&gt;
                      &lt;input id="btn_login" name="btn_login" type="submit" class="btn btn-primary btn-lg col-xs-12" style="margin-top: 5px; margin-bottom: 5px;" value="Login" /&gt;
                    &lt;/div&gt;
                    &lt;div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"&gt;
                      &lt;input id="btn_cancel" name="btn_cancel" type="reset" class="btn btn-primary btn-lg col-xs-12" style="margin-top: 5px; margin-bottom: 5px;" value="Cancel" /&gt;
                    &lt;/div&gt;
              &lt;/div&gt;
            &lt;/fieldset&gt;
            &lt;?php echo form_close(); ?&gt;
            &lt;/div&gt;
       &lt;/div&gt;
  
        &lt;div class="col-xs-12 col-sm-3 col-md-3 col-lg-3"&gt;
        &lt;p&gt;test&lt;/p&gt;
        &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>CONTROLLER LOGIN </p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class login extends CI_Controller
  {
       public function __construct()
       {
            parent::__construct();
            $this-&gt;load-&gt;model('account/login_model');
       }
  
       public function index()
       {
  
  
            $data['Title'] = "";
            $data['Description'] = "";
            $data['Keywords'] = "";
            $data['Type'] = "";
            $data['Url'] = "";
  
            $this-&gt;load-&gt;view('includes/header', $data);
  
            //get the posted values
            $username = $this-&gt;input-&gt;post("txt_username");
            $password = $this-&gt;input-&gt;post("txt_password");
  
            //set validations
            $this-&gt;form_validation-&gt;set_rules("txt_username", "Username", "trim|required|min_length[8]|max_length[30]|xss_clean");
            $this-&gt;form_validation-&gt;set_rules("txt_password", "Password", "trim|required|min_length[8]|max_length[32]|xss_clean");
  
            if ($this-&gt;form_validation-&gt;run() == FALSE)
            {
                 //validation fails
                 $this-&gt;load-&gt;view('account/login');
            }
            else
            {
                 //validation succeeds
                 if ($this-&gt;input-&gt;post('btn_login') == "Login")
                 {
                      //check if username and password is correct
                      $usr_result = $this-&gt;login_model-&gt;get_user($username, $password);
  
                      if ($usr_result &gt; 0) //active user record is present
                      {
                           //set the session variables
                           $sessiondata = array(
                                'username' =&gt; $username,
                                'loginuser' =&gt; TRUE
                           );
                           $this-&gt;session-&gt;set_userdata($sessiondata);
                           redirect("members/members_area");
                      }
                      else
                      {
                           $this-&gt;session-&gt;set_flashdata('msg', '&lt;div class="alert alert-danger text-center"&gt;Invalid username or password! Please try again.&lt;/div&gt;');
                           redirect('account/login');
                      }
                 }
                 else
                 {
                      redirect('account/login');
                 }
            }
             $this-&gt;load-&gt;view('includes/footer');
       }
  
  }
  </code></pre>
  
  <p>The login seems to work and redirects to the members area however when I check the ci_session table it's empty. </p>
  
  <p>Once in the members area I want to logout which should destroy the current session and then redirect to the index.php home page which is doesn't do.</p>
  
  <p>Here is the members V\C</p>
  
  <p>CONTROLLER MEMBER AREA</p>
  
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Members_Area extends CI_Controller {
  
      public function __construct()
       {
            parent::__construct();
            $this-&gt;loginuser();
       }
  
      public function index()
      {
  
  
          $data['Title'] = "";
          $data['Description'] = "";
          $data['Keywords'] = "";
          $data['Type'] = "";
          $data['Url'] = "";
  
          $this-&gt;load-&gt;view('includes/member_header' , $data);
          $this-&gt;load-&gt;view('members/members-area');
          $this-&gt;load-&gt;view('includes/footer');
  
      }
  
      function loginuser()
      {
          $loginuser = $this-&gt;session-&gt;userdata('loginuser');
  
          if (!isset($loginuser) || $loginuser != true ) 
          {
              echo 'Sorry you dont have premission to access this area. Please signup and login to gain access to this area.';
              die();
          }
      }
  }
  </code></pre>
  
  <p>VIEW MEMBER AREA
       </p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;div class="well col-xs-12 col-sm-12 col-md-12 col-lg-12"&gt;
          &lt;h3&gt;Members Area&lt;/h3&gt;&lt;br /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the logout V and C</p>
  
  <p>CONTROLLER LOGOUT</p>
  
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Logout extends CI_Controller {
  
      public function index()
      {
  
  
          $data['Title'] = "";
          $data['Description'] = "!";
          $data['Keywords'] = "";
          $data['Type'] = "";
          $data['Url'] = "";
  
          $this-&gt;load-&gt;view('includes/header' , $data);
  
            // destroy session
            $this-&gt;session-&gt;sess_destroy();
            // redirect to other page
            redirect('account/logout');
  
          $this-&gt;load-&gt;view('includes/footer');
      }
  }
  </code></pre>
  
  <p>VIEW LOGOUT</p>
  
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed'); ?&gt;
  &lt;div class="container"&gt;
        &lt;div class="col-xs-12 col-sm-9 col-md-9 col-lg-9"&gt;
            &lt;h2&gt;You have logged out.&lt;/h2&gt;
            &lt;/div&gt;
       &lt;/div&gt;
  
        &lt;div class="col-xs-12 col-sm-3 col-md-3 col-lg-3"&gt;
        &lt;p&gt;test&lt;/p&gt;
        &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Any advice or direction from you folks would be a huge help.</p>
  
  <p>Thanks!</p>