Hi i'm making a login system for a online server and when i try to login i keep geting this error being thrown and i cant seem to find a way to fix this any help would be grateful. i have had a look and people say that its because of mysqlnd not being enabled but i have checked the database php version it is php 7.0 and it is enabled and i cant seem to find a fix, any help with this or tips on secure login would be grateful thanks.
This is my funtcion.php page which connects to 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;
}
and then my forms process.php page
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");
}
}