Created
February 8, 2011 04:13
-
-
Save ss23/815837 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$Password1 = 'WrongPassword'; | |
$Password2 = 'SuperSecurePassword123'; | |
$sql = "select `Password` from `Users` where id = 5"; | |
$res = mysql_query($sql); | |
if ($res) { | |
$foo = mysql_fetch_assoc($res); | |
$HashedPassword = $foo['Password']; | |
} else { | |
die('error'); | |
} | |
// Now, what about checking if a password is the right password? | |
if (crypt($Password1, $HashedPassword) == $HashedPassword) { | |
echo "Hashed Password matched Password1"; | |
} else { | |
echo "Hashed Password didn't match Password1"; | |
} | |
if (crypt($Password2, $HashedPassword) == $HashedPassword) { | |
echo "Hashed Password matched Password2"; | |
} else { | |
echo "Hashed Password didn't match Password2"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment