I'm trying to see if a user logging in has entered the right password, which is stored as an md5 hash. when i echo the hash of the password entered, it matches exactly the hash of the one in the database, but it still thinks its false. Heres the code:
echo md5($_POST['pass']);
if ($user->match_password($_POST['pass']) == true) {
...
} else {
...
}
it tries to execute the else code above ^
class user {
...
var $password;
...
function user($id) {
global $DB;
$this->db = new db($DB['host'], $DB['user'], $DB['pass'], $DB['database']);
$this->user_id = $id;
$u_result = $this->db->run("select * from users where use_id = " . $this->db->escape($this->user_id));
...
$this->password = $u_reuslt[0]['password'];
...
}
...
function match_password($password) {
return ($this->password == md5($password));
}
}