Skip to content

Instantly share code, notes, and snippets.

@ErMandeep
Created November 14, 2018 10:56
Show Gist options
  • Save ErMandeep/2a813abde166b915ea2554ff5e868b78 to your computer and use it in GitHub Desktop.
Save ErMandeep/2a813abde166b915ea2554ff5e868b78 to your computer and use it in GitHub Desktop.
password hashing
$password = $_POST['password'];
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
// Query the database for username and password
// ...
if(password_verify($password, $hashed_password)) {
// If the password inputs matched the hashed password in the database
// Do something, you know... log them in.
}
// Else, Redirect them back to the login page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment