title: Session is not being destroy in codeigniter
body: <p>I am trying to unset my current logged in user's session.It's working fine if i am doing normal login but when i use remember me settings using cookies it's not being destroy.</p>
  
  <p>My code for set the session and cookie is</p>
  
  <pre><code>public function login() {
      if(isset($this-&gt;session-&gt;userdata['username']) || isset($_COOKIE['user_id'])){
           $this-&gt;load-&gt;model('User');
  
              $p_uid = $this-&gt;User-&gt;user_login($_COOKIE['user_id'], $_COOKIE['password']);
  
       redirect(base_url() . "dashboard");
      }else{
  
  
  
      $this-&gt;form_validation-&gt;set_rules('user_id', 'User ID', 'required');
      $this-&gt;form_validation-&gt;set_rules('password', 'Password', 'required');
      if ($this-&gt;form_validation-&gt;run() == FALSE) {
          $this-&gt;load-&gt;view('login/login');
  
      } else {
  
          $user_id = $this-&gt;input-&gt;post('user_id');
          $password = $this-&gt;input-&gt;post('password');
          $this-&gt;load-&gt;model('User');
  
              $p_uid = $this-&gt;User-&gt;user_login($user_id, $password);
              //var_dump($p_uid);
              if ($p_uid) {
                  if(isset($_POST['remember_me'])){
                      setcookie("user_id",$user_id,time()+86400*30);
                      setcookie("password",$password,time()+86400*30);
  
                  }
  
  
                 redirect(base_url() . "dashboard/");
              } else {
                  $data=array(
                  "error"=&gt;"Wrong Userid Or Password"
                  );
                  $this-&gt;load-&gt;view('login/login',$data);
              }
  
      }
      }
  
  
  }
  </code></pre>
  
  <p>And My logout Function is:</p>
  
  <pre><code>public function logout(){
  
      $this-&gt;load-&gt;helper('cookie');
      delete_cookie("user_id");
      delete_cookie("password");
  
      $this-&gt;session-&gt;unset_userdata("username");
      $this-&gt;session-&gt;sess_destroy();
  
      redirect(base_url());
  }
  </code></pre>
  
  <p>Where i am doing mistake. please help. Thanks</p>