$passHash = trim($_POST['password']);
$hash = password_hash($passHash, PASSWORD_DEFAULT, ['cost' => 5]);
$query = "INSERT INTO reg (name_reg, email, password) VALUES ('$name_reg', '$email', '$hash')";
$loadData = mysqli_query($conn, "SELECT * FROM reg WHERE email = '$formEmail'");
$userData = mysqli_fetch_array($loadData);
$passwd = trim($_POST['password']);
var_dump($userData);
$checkPasswd = password_verify($passwd, $userData["password"]);
if ($checkPasswd === true){
echo "Пароль верный!";
}else{
echo "Пароль НЕ ВЕРНЫЙ!!";
}
<div class="card-body">
<?php
if ($result) {
$message = "Комментарий успешно добавлен";
setcookie('message', $message, time() + 2, '/');
}
?>
<div class="alert alert-success" role="alert">
<?php echo $_COOKIE["message"]; ?>
</div>
Получилось вот так:
Вывод:
/WebServ/localhost/test.php:33:
array (size=1)
1 => string '2432792430352469522f64302e5864306247566667626b67536b6b4965457363622e67324d704e794b5658324f597770425676613451756335624136' (length=120)
/WebServ/localhost/test.php:38:
array (size=1)
1 => string '2432792430352469522f64302e5864306247566667626b67536b6b4965457363622e67324d704e794b5658324f597770425676613451756335624136' (length=120)
РАВНО