Skip to content

Instantly share code, notes, and snippets.

@ss23
Created January 11, 2011 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ss23/774376 to your computer and use it in GitHub Desktop.
Save ss23/774376 to your computer and use it in GitHub Desktop.
PHP crypt() password checking
<?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