Facts:登錄用戶,避免取消用戶帳戶?
- 我們系統上的用戶可以通過他們的電子郵件地址和密碼登錄。
- 電子郵件地址是唯一的標識符,但如果accoutn被取消,另一個人可以使用相同的電子郵件地址註冊。以前的記錄仍然在我們的系統中。
- 如果被取消的用戶試圖登錄,我們不應該允許他訪問。
現在,當在登錄用戶時檢查記錄是否存在時,是否正確執行以下操作?
$rs=$DBobject->execute_query("select * from users where `email`='".$email."' and `password`='".passwordMD5($password)."' and status!='cancelled'");
if($DBobject->my_num_rows($rs)>0)
{
// login the user
}
else
{
// check if account has been cancelled
$rs_cancelled=$DBobject->execute_query("select id from users where `email`='".$email."' and `password`='".passwordMD5($password)."' and status='cancelled'");
if($DBobject->my_num_rows($rs_cancelled)>0)
{
return "Your account has been cancelled";
}
else
{
return "Invalid email/password";
}
}
我特別關注的事實是,我們正在使用的密碼,以唯一標識記錄($rs_cancelled
) - 可以在用於不可告人的目的?上述過程如何被顛覆?
我並不完全明白你的意思是'使用密碼來唯一標識記錄'。你能否詳細說明一下。 – Balanivash