i'm trying to make the password_verify match the crypt password in the database, but i'm having a problem, it seems it doesn't match.
I already search for this and i've found that i need to use VARCHAR with a maximum length of 255 and still doesn't work.
Here is the code:
if( isset($_POST['bG9n']) && "bG9naW4") {
$email = $_POST['email'];
$pass= $_POST['pass'];
if($pass) {
$crypt = password_hash($pass,PASSWORD_BCRYPT);
$decrypt = password_verify($pass,$crypt);
}
if(password_verify($pass,$crypt)) {
echo "Sucess"; // It does echo Sucess
}
if (!empty($email) && !empty($pass) && filter_var($email,FILTER_VALIDATE_EMAIL) && password_verify($pass,$crypt)) {
$sql = "SELECT email, pass FROM clientes WHERE email ='$email' AND pass = '$decrypt' ";
$query = $DB_con->prepare($sql);
$query->execute();
$count = $query->rowCount();
if($count == 1){
$_SESSION['email'] = $email;
$_SESSION['pass'] = $decrypt;
header("Location: home.php");
}
else {
echo "<BR>Error";
}
}
Probably is an easy fix but i can't seem to find what's wrong.
Thanks everyone in advance.