您好我正在为在线服务器创建一个登录系统,当我尝试登录时,我一直在试图抛出这个错误,我似乎无法找到解决这个问题的方法,任何帮助都会感激不尽。我看了一眼,人们说它是因为mysqlnd没有启用,但我检查了数据库php版本它是PHP 7.0,它启用,我似乎无法找到修复,任何帮助这个或安全登录提示非常感谢。
这是我的funtcion.php页面,它连接到process.php
public function getUserByEmailAndPassword($email, $password) {
$stmt = $this->conn->prepare("SELECT * FROM users WHERE email = ?");
$stmt->bind_param("s", $email);
if ($stmt->execute()) {
$user = $stmt->get_result()->fetch_assoc(); // this line causes the error
$stmt->close();
// verifying user password
$salt = $user['salt'];
$encrypted_password = $user['encrypted_password'];
$hash = $this->checkhashSSHA($salt, $password);
// check for password equality
if ($encrypted_password == $hash) {
// user authentication details are correct
return $user;
}
} else {
return NULL;
}
然后我的表格process.php页面
session_start();
require_once 'include/functions.php';
$db = new Functions();
// json response array
if (isset($_POST['email']) && isset($_POST['password'])) {
// receiving the post params
$email = $_POST['email'];
$password = $_POST['password'];
// get the user by email and password
$user = $db->getUserByEmailAndPassword($email, $password);
if ($user != false) {
//user is found
$_SESSION['loggedin'] = true;
$_SESSION["userid"] = trim($user["id"]);
$_SESSION["first_name"] = $user["first_name"];
$_SESSION["last_name"] = $user["last_name"];
$_SESSION["email"] = $user["email"];
//start session() and redirect to homepage.
header("Location: ../dashboard.php");
} else {
// user is not found with the credentials
$_SESSION['Error'] = "Email or Password is Incorrect. Please try again!";
header("Location:../signin.php");
}
}