I have decided to use crypt() to encrpyt my passwords on my database using a salt, as after much research it seems the best option.
I am curious though as to why this works and gets a match:
$info['password'] == crypt($_POST['password'])
And comparing identically like this doesn’t:
$info['password'] === crypt($_POST['password'])
Any ideas?
Thanks.
The documentation explains the phenomenon you’re experiencing. The second argument documentation states:
There’s every chance you’ll get 10 different values when you run the following:
I get the following:
I’d recommend using your database salt as the second argument for your
crypt($password, $salt)call.