$sql = "SELECT * FROM users WHERE username='$username'"; $query = $this->db->query($sql); $count = $query->num_rows(); if ($count == 1) { $row = $query->row(); $hash = $row->password; $hash = '$2y$10$zF/7n3QOAq9ADh2S4kBZBuz94QNzCA0GyRfd1WT7JqNhDVpcXQgEq'; $pass = 'hello'; if (password_verify($pass, $hash)) { return "success"; } else { $data = "Hash: " .$hash." Password:".$pass; return $data; } } else { return "zero rows"; }
$sql = "SELECT * FROM users WHERE username='$username'"; $query = $this->db->query($sql); $count = $query->num_rows(); if ($count == 1) { $row = $query->row(); $hash = $row->password; //$hash = '$2y$10$zF/7n3QOAq9ADh2S4kBZBuz94QNzCA0GyRfd1WT7JqNhDVpcXQgEq'; $pass = 'hello'; if (password_verify($pass, $hash)) { return "success"; } else { $data = "Hash: " .$hash." Password:".$pass; return $data; } } else { return "zero rows"; }
Hash: $2y$10$zF/7n3QOAq9ADh2S4kBZBuz94QNzCA0GyRfd1WT7JqNhDVpcXQgEq Password:hello
password_verify($pass, $hash)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)