title: Using encryption class in Codeigniter
body: <p>My problem is that I can still log in even I typed in the wrong password. I can't seem to know if there's a problem on how I decoded the password.</p>
  
  <p>encryption key:</p>
  
  <pre><code>$config['encryption_key']   = 'formcreatormj';
  </code></pre>
  
  <p>Log in code:</p>
  
  <pre><code>function login($email,$password){
      $pw = $this-&gt;encrypt-&gt;decode($password);
  
  $this-&gt;db-&gt;where('email',$email);
      $this-&gt;db-&gt;where('password', $pw);
  
      $query=$this-&gt;db-&gt;get('user');
  
     if($query-&gt;num_rows()&gt;0){
          foreach($query-&gt;result() as $rows){
              //add all data to session
              $this-&gt;addSession($rows-&gt;id, $rows-&gt;username);
          }
  
          return true;
      }
      return false; 
  }
  </code></pre>