I encountered a problem while implementing my extra feature "Change Password". In the "changepassword_form", it asks for the old password and compares it with the 'hash' in the 'users' table to check whether user has entered correct old password. I used something like
if(crypt($_POST["old"]) == $hash)
{
// some code
}
else
{
apologize("Passwords don't match!");
}
Even if I type the right password, the else statement gets executed. What's wrong with the code above?