我正在嘗試查看登錄的用戶是否輸入了正確的密碼,該密碼存儲爲md5哈希值。當我回應輸入的密碼散列時,它與數據庫中散列的散列完全匹配,但它仍然認爲它是錯誤的。繼承人的代碼:爲什麼php會說兩個相等的東西是不平等的?
echo md5($_POST['pass']);
if ($user->match_password($_POST['pass']) == true) {
...
} else {
...
}
它試圖執行其他代碼上面^
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));
}
}
我猜``u_reuslt`變量只是一個錯字...? – deceze 2009-07-22 05:07:25