我正在尝试使用password_hash函数,但不知道哪里出了问题 每当我点击正确的凭据时,它都会说无效的凭据
php代码:filename:verify.php
<?php
$con = mysqli_connect('localhost','root','','notification');
if($con == FALSE)
{
echo "connection is not done";
}
if(isset($_POST['submit']))
{
$inputmail = $_POST['email'];
$inputpass = $_POST['password'];
}
$qry = "SELECT * FROM `users` WHERE username = '$inputmail'";
$result = mysqli_query($con,$qry);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
if (password_verify($inputpass, $row['password'])) {
echo "Success!";
}
else {
echo "Invalid credentials";
}?>
html代码:
<!DOCTYPE>
<html>
<body>
<form action="verify.php" method="post" id="login-form">
<input type="text" name="email" placeholder="Email ID" required>
<input type="password" name="password" placeholder="Password" required>
<input type="submit" name="submit" class="login login-submit" value="Login">
</form>
</body>
</html>