I want use password_verify to login, and this is my code
$DB1->select('Idx,Email,Password');
$DB1->from('User');
$DB1->where('Email',$Email);
$result = $DB1->get()->result();
// get_where('4SUser',array('Email' => $Email))->result();
if(password_verify($this->input->post('Password'), $result[0]->Password)) {
$this->response("Login Success");
} else {
$this->response("Login Failed");
}
And then, this is when I join the member use password_hash
---update change $hash = password_hash($this->input->post('Password'), PASSWORD_DEFAULT);
I don't know why it returns error;
use password tester1234 and in DB, $2y$10$FZ7WV5cn5OL58t5hgM3cBeb2NRfXk7IrxNzyBiBMYZA.HYtXSSDjS
this is DB value.
But when I test hash_password when I input the password,
"$2y$10$KP1MG1abyMBD/gR82WmKoONvW/VvblYix13We6MNeRKdbDg0ufRQC"
"$2y$10$2H7Lx340yXWBFXFgv2LUJuN.luODBmJtNwfrCVQh2A37O0Es9Ud/K"
"$2y$10$.xUl/0zKnt.m26MSVwUBDOFVx29Bd8XxNyI.t7RqonfP8pmwIIVRC"
Every Time changes
Is it cause the error of doesn't match the password?
please help me
---update question
$HashInputPassword = password_hash($this->input->post('Password'), PASSWORD_DEFAULT);
$UserPassword = $result[0]->Password;
if($HashInputPassword === $UserPassword) {
$this->response("Login Success");
} else {
$this->response("Login Failed");
}