Skip to content

Instantly share code, notes, and snippets.

@randika
Created January 30, 2014 06:59
Show Gist options
  • Save randika/8703861 to your computer and use it in GitHub Desktop.
Save randika/8703861 to your computer and use it in GitHub Desktop.
<?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