SHARE
TWEET

password_verify fail

a guest Dec 13th, 2016 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CONTROLLER 
  2. public function check()
  3.     {
  4.         // print_r ($_POST);
  5.         $password = $this->input->post('password');
  6.         $passwordhash = password_hash($password, PASSWORD_DEFAULT);
  7.         $data['username'] = $this->input->post('username');
  8.         $data['password'] = $password;
  9.  
  10.         $res = $this->m_user->verif_user($data);
  11.         var_dump($res);
  12.     }
  13.  
  14. MODEL
  15. public function verif_user($data)
  16.     {
  17.         // $kondisi = "username =" . "'" . $data['username'] . "' AND " . "password =" . "'" . $data['password'] . "'";
  18.         $kondisi = "username =" . "'" . $data['username'] ."'";
  19.         $this->db->select('*');
  20.         $this->db->from('daftar_user');
  21.         $this->db->where($kondisi);
  22.         $this->db->limit(1);
  23.         $query = $this->db->get();
  24.  
  25.         if ($query->num_rows() == 1)
  26.         {
  27.             foreach ($query->result() as $row) {
  28.                 $hash = $row->password;
  29.             }
  30.             return password_verify($data['password'], $hash);
  31.         } else
  32.         {
  33.             return false;
  34.         }
  35.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top