php - 未定义索引:密码即使我用过 isset
问题描述
在提出这个问题之前请稍候,因为从我所看到的情况来看,我尝试了大多数答案中显示的所有技术,但它没有奏效。拜托,我已经解决这个错误好几天了,并尝试了一切,让我们一起努力寻找解决办法!如果您需要任何其他代码或详细信息,请在评论中询问。谢谢
出现此错误:
这是我的 login.php:
<?php
if (isset($_POST['email']) || isset($_POST['password']))
{
require_once 'connect.php';
$email = $mysqli->escape_string($_POST['email']);
$password = $mysqli->escape_string($_POST['password']);
$result = $mysqli->query("SELECT * FROM users WHERE email='$email'");
if ($result->num_rows == 0){
echo "Did not find any user with this email.";
exit();
}
else {
$user = $result->fetch_assoc();
//LINE 16//if (password_verify($password, $user['password'])){**
$_SESSION['id'] = $user['id'];
$_SESSION['email'] = $user['email'];
echo "Success.";
}else{
echo "Wrong Password";
die();
}
}
}
?>
这是我的 login_page.php:
<?php require_once 'header.php' ?>
<center>
<h1 class='pageTitle'>Login</h1>
<a href="register_page.php" class='registerLink'> Or Register</a><br>
<form action="login.php" method="post">
<input type="text" name="email" placeholder="Email"> <br>
<input type="password" name="password" placeholder="Password"><br>
<input type="submit" value="Submit">
</form>
</center>
<?php require_once 'footer.php' ?>
解决方案
推荐阅读
- android - 在 Android Navigation Architecture 中,如何获取之前的片段名称?
- javascript - 悬停时更改 div 中的本地图像
- java - 运行应用程序的问题;显示一些错误信息
- c++ - 自定义向量/动态数组 C++ 问题
- key - json键中的分数使jq失败
- c++ - 为什么在我的打印函数中使用 do-while 循环时会出现无限循环
- flutter - 在 Flutter Row 中,有没有办法在使用 MainAxisAlignment.spaceBetween 时使孩子居中对齐?
- java - 并行化反序列化步骤
- 3d - F90 从非恒定分辨率 3D 网格到恒定分辨率网格的插值
- javascript - 渲染组件时无法在回调中获取 prop 的值,直到将 useEffect 置于无限循环中