Created
January 30, 2014 06:59
-
-
Save randika/8703861 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 | |
$user_signup_password = 'password'; | |
$pass = urlencode($user_signup_password); | |
$pass_crypt = crypt($pass); // Crypt will add a salt by default | |
echo "signup password: ".$pass_crypt; // You save this on database | |
$user_login_password = "password"; // This is what will you enter when login - change this to see if it works | |
echo "<br>"; | |
// USER AUTH CHECK - compare $user_login_password with $pass_crypt stored in database | |
if ($pass_crypt == crypt($user_login_password, $pass_crypt)) { | |
echo "Success! Valid password"; | |
} else { | |
echo "Invalid password"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment