问候, 具有基本的注册/登录形式,仅使用password_hash将散列存储在db中。在检查密码登录时遇到问题
试图不煮我的面包:)
<?php
session_start();
require_once 'conn.php';
if(ISSET($_POST['login'])){
if($_POST['user_name'] != "" || $_POST['password'] != ""){
$username = $_POST['user_name'];
$password = $_POST['password'];
$sql = "SELECT * FROM `users` WHERE `user_name`=? AND `password`=? ";
$query = $conn->prepare($sql);
$query->execute(array($username,$password));
$row = $query->rowCount();
$fetch = $query->fetch();
if($row > 0) {
$_SESSION['user'] = $fetch['user_id'];
header("location: home.php");
} else{
echo "<script>alert('Detalii Incorecte'); window.location='login.php'</script>";
}
}else{
"<script>alert('Completeaza tot!'); window.location='login.php'</script>";
}
}
?>
好的,我在这里想念什么 当我存储纯文本时,这非常适合... 当我应用pasword_hash时,我很难“重写”我的代码以匹配哈希密码fom列
答案 0 :(得分:-1)
sem_init
已修复! ! ! 但无论如何,在这里的大多数帖子中,都说“不需要在登录中输入paword_hash.PHP ...一直都是这样...