P粉0990000442023-07-31 13:54:06
I found the problem! The problem seems to be caused by the use of double quotes (") in the $adminPasswordHashVERIFY variable. When double quotes are used, PHP interprets the string and replaces the variables within it. Since there is no variable named $fReIQ, PHP treats it as un variable defined, causing an incorrect hash value to be generated during verification.
To resolve this issue, use single quotes (') around the hashed password in the $adminPasswordHashVERIFY variable. This ensures that the hashed password is treated as A normal string instead of being interpreted by PHP.
Now if you try the following code you will get the output "Password correct! ".
<?php $adminPassword = "test123"; $adminPasswordHash = password_hash($adminPassword, PASSWORD_BCRYPT); $adminInputPassword = "test123"; $adminPasswordHashVERIFY = 'y$o4qspRTirOSdyGtwHCxt6ee2i0BNChl3mEPazxVbmb534kw3ACHCm'; if (password_verify($adminInputPassword, $adminPasswordHashVERIFY)) { echo "Password is correct!"; } else { echo "Password is incorrect!"; } ?>