xxxxxxxxxx
if ($_POST["password"] === $_POST["confirm_password"]) {
// success!
}
else {
// failed :(
}
xxxxxxxxxx
<?php
// See the password_hash() example to see where this came from.
$hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq';
if (password_verify('rasmuslerdorf', $hash)) {
echo 'Password is valid!';
} else {
echo 'Invalid password.';
}
?>
xxxxxxxxxx
<?php
$password = 'user-entered-password'; // The password entered by the user
$hashedPassword = '$2y$10$SOMEHASHEDPASSWORD'; // The hashed password stored in the database
if (password_verify($password, $hashedPassword)) {
echo 'Password is valid!';
} else {
echo 'Invalid password!';
}
?>