This code is in my user.php
file
include('password.php');
class User extends Password{
private $_db;
function __construct($db){
parent::__construct();
$this->_db = $db;
}
private function get_user_hash($email){
try {
$stmt = $this->_db->prepare('SELECT password FROM users WHERE email = :email AND active="Yes" ');
$stmt->execute(array('email' => $email));
$row = $stmt->fetch();
return $row['password'];
} catch(PDOException $e) {
echo '<p class="bg-danger">'.$e->getMessage().'</p>';
}
}
public function login($email,$password){
$hashed = $this->get_user_hash($email);
if($this->password_verify($password,$hashed) == 1){
$_SESSION['loggedin'] = true;
return true;
}
}
public function logout(){
session_destroy();
}
public function is_logged_in(){
if(isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true){
return true;
}
}
}
And this code is part of my login.php
file
function login($email,$password){
$hashed = $this->get_user_hash($email); <--the error is in this line
if($this->password_verify($password,$hashed) == 1){
$_SESSION['loggedin'] = true;
return true;
}
I honestly don't know what to do, I'm still learning these kinds of things & I'm not really good with classes and objects that's why I'm asking everyone to help me fix this problem.