[eluser]gork7478[/eluser]
I have a problem that I really hope someone can help me with. In my model I have this code the get hashed password from database.
Code:
public function getPasswordHash($email) {
$sql = 'SELECT `password` FROM users WHERE email=? LIMIT 1';
$query = $this -> db -> query($sql, array($email));
return ($query -> num_rows() > 0) ? $query -> row() : FALSE;
}
Now I have a callback function that I'm trying to run to compared password in controller here's the code for that.
Code:
function _checkPassword($pass)
{
$hasher = new PhpAss();
$this->load->model('user');
$hashed_pass = $this->user->getPasswordHash($this->input->post('email'));
$hashed_pass = $hashed_pass->password;
if ($hasher->checkPassword($pass, $hashed_pass))
{
echo 'true';
}
else
{
$this->form_validation->set_message('_checkPassword', 'The Email and/or Password is incorrect. Please try again');
return false;
}
}
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/main.php
Line Number: 149
And this is the error I'm getting when I put the wrong password in my form. If I put the correct password it works. Any help would be greatly appreciated.