Below is my code to set password and check password on login but it didn’t work. i had password field of varchar(1000). Using MYSQL database
when creating username and password by admin initially password is same as username but in lowercase with dash
$user_name1 = explode(" ", $staff_name);
$user_name2 = implode("-", $user_name1);
$user_name2 = strtolower($user_name2);
$user_pwd = password_hash($user_name2, PASSWORD_DEFAULT);
checking at the time of login
$upass = mysqli_real_escape_string($conn, $_POST['upass']);
if(password_verify($upass, $stt['staff_upwd']))
{
....
}
$upass is the password entered by the user and $stt[‘staff_upwd’] is the stored password from database.
i echo both the passwords it displays different. can anyone spot the mistake which i am not able to understand. should i using base64_encode and base64_decode method with salt key. and in addition pass some random token key at the time of login.
i also tried to remove mysqli_real_escape_string but of no avail.
Regards Himanshoo