title: Login MD5 in codeigniter
body: <p>This is my controller and models, I can't check password.</p>
  
  <p>Controller : </p>
  
  <pre><code>function login() {
      $data = array();
      if ($this-&gt;input-&gt;post('username') != '') {
          $data = $this-&gt;loginm-&gt;login($this-&gt;input-&gt;post('username'), md5($this-&gt;input-&gt;post('password')));
          if ($data['success'] == TRUE) {
              $type = $this-&gt;session-&gt;userdata('type');
              if($type==1){ // Admin
                  // redirect(get_slug('test',false));
                  $this-&gt;load-&gt;view("test");
  
              }
          }
  
          $data['username'] = $this-&gt;input-&gt;post('username');
          $data['password'] = $this-&gt;input-&gt;post('password');
      }
  </code></pre>
  
  <p>Models :</p>
  
  <pre><code>function login($name, $pass) {
      // $data['success'] = FALSE;
      $user = $this-&gt;db-&gt;where('username', $name)-&gt;where('deleted', 0)-&gt;get($this-&gt;prefix . 'user');
      if ($user-&gt;num_rows() &gt; 0) {
          $user = $user-&gt;row();
          if ($this-&gt;bcrypt-&gt;verify($pass, $user-&gt;password)) { 
              $data['success'] = TRUE;
              $this-&gt;session-&gt;set_userdata(array('user' =&gt; $user-&gt;user_id));
              $this-&gt;session-&gt;set_userdata(array('type' =&gt; $user-&gt;user_type));
          } else {
              $data['success'] = FALSE;
              $data['message'] = 'Username or password wrong !!';
          }
      } else {
          $data['success'] = FALSE;
          $data['message'] = 'Username or password wrong !!';
      }
      return $data;
  }
  </code></pre>
  
  <p>When I login right username and password but show note 'Username or password wrong'!! </p>