Created
January 11, 2011 12:57
-
-
Save ss23/774376 to your computer and use it in GitHub Desktop.
PHP crypt() password checking
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 | |
$Password = $_POST['Password']; | |
$Query = "select `Password` from `Users` where `Username` = '" . mysql_real_escape_string($_POST['Username']) . "'"; | |
$res = mysql_query($Query); | |
$row = mysql_fetch_assoc($res); | |
$HashedPassword = $row['Password']; | |
// Now, what about checking if a password is the right password? | |
if (crypt($Password, $HashedPassword) == $HashedPassword) { | |
echo "Hashed Password matched Password"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment