[eluser]markanderson993[/eluser]
I am trying to write a script to allow the user to change their password. I have all of the required code down (check if certain fields are filled in yatta yatta). The part I am having grief over is checking weather or not the user's inputted current password matches that of their real current password in the database.
This is what I have. This code is the problematic portion. It is supposed to send back a TRUE/FALSE value depending on weather it found a match.
Problem is: I'm getting two errors
1. Undefined property: CI_DB_mysql_result::$hash
3. Undefined property: CI_DB_mysql_result::$password
Code:
//* check_password
public function check_password($users, $current_password)
{
$username = $this->ci->session->userdata('username');
$result = $this->ci->db->select('password','hash')->from($users)->where($users.'.username', $username)->get();
$password = sha1($this->salt.$result->hash.$current_password); # New hashed password
if ($password === $result->password)
{
return true;
}
}