This is a program that i used to test your condition. Plz check this out i think you've missed something in your posing especially you haven't mentioned you used htmlentities() on your password.
If you apply md5() along it won't give you this result &`#33;@#&`#036;%^&*()?abc123
PHP Code:
<?php
//this program doesn't use database as you mentioned in your post. But i think you can find some fairly good idea from this program
//The password given for the testing purpose
$pass = "!@#$%^&*()?abc123";
//Display the value if we call the htmlentities()
echo "Value of $pass after applying htmlentities function : " .htmlentities($pass) ."<br><br>\n";
$htmlpass = htmlentities($pass);
//The output value you mentioned in your posting will be the output
//&`#33;@#&`#036;%^&*()?abc123
//Applying hashing function on the password that has already been applied the HTML encoding
$pass_stored = md5($htmlpass);
//displaying the finaal password you stored in your db
echo "The password stored in your database: $pass_stored <br>\n";
//You want to check a user entered password is matching with the password stored
//I am assuming that we are dealing with this one password here
//The password from the user
$sent_password = "!@#$%^&*()?abc123";
//Applying html encoding on it
$sent_password = htmlentities($sent_password);
//applying hashing on the HTML encoded password from the user and comparing it with the password
//that is in DB already hashed and HTML encoded
if($pass_stored == md5($sent_password))
echo "Passwords are matching<br>\n";
else
echo "Passwrods are not matching<br>\n";
?>
If i run the above code I am getting an output Passwords are matching.
html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities to their applicable characters from string. If thats what you are looking for.
Bookmarks