Important note
If you’re using this code for anything requiring real security (i.e. not just a student project) MD5 is not an appropriate hashing algorithm. Read through the OWASP advice to learn how to do this properly.
Answering your question
You have:
$psd= md5($_POST['psw']);
$confirm_psd= $_POST['confirm_psw'];
if ($psd == $confirm_psd)
{
...
which looks like you’re comparing the plain text value of confirm_psd
with the MD5 hashed value of psw
, which obviously won’t match.
I’d suggest you either do the comparison before hashing the psw
field, like:
$confirm_psd= $_POST['confirm_psw'];
if ($_POST['psw'] == $confirm_psd)
{
$psd= md5($_POST['psw']);
...
Or also hash the confirm_psw
value before the comparison like this:
$psd= md5($_POST['psw']);
$confirm_psd= md5($_POST['confirm_psw']);
if ($psd == $confirm_psd)
{
...
and then your comparison should work as you expect.
0
solved I am designing signup page, every time it displays your password dont match