<?php
if (isset($_POST) & !empty($_POST)) {
$email = mysqli_real_escape_string($conn, $_POST['email']);
$Password = $_POST['passwords'];
$check_database_query = "SELECT * FROM registered_users WHERE Student_email='$email'";
$result = mysqli_query($conn, $check_database_query);
if (mysqli_num_rows($result) == 1) {
if ($data = mysqli_fetch_array($result)) {
$passhash = (password_verify($Password, $data['password']));
if ($passhash == false) {
$msg = "invalid username or password";
} else {
$_SESSION['email'] = $email;
header('Location:index.php');
}
}
} else {
$msg2 = "error";
}
}
?>
HTML
<form class="form-signin" method ="POST">
<h2 class="form-signin-heading">Please Login First</h2>
<input type="email" class="form-control" name="email" placeholder="Email Address">
<input type="password" class="form-control" name="password" placeholder="Password">
</form>
这不会让我登录。是因为我将哈希密码与哈希或...进行比较?对于缩进感到抱歉。