當用戶登錄我的網站時,我創建了以下禁止系統。它會檢查用戶是否被禁止,然後遵循一個過程來收集信息,最後出現通知並且不讓用戶登錄。但是,這不會發生,我可以登錄罰款。任何幫助將被appriciated。登錄時禁止登錄系統的問題
$un9 = "gdscei";
$checkban = mysql_query("SELECT * FROM bans WHERE usr = '" .$un9. "'") or die(mysql_error());
if(mysql_num_rows($checkban) != 0){
$query7 = "SELECT * FROM bans WHERE usr = '".$un9."'";
$result7 = mysql_query($query7) or die(mysql_error());
while ($row7 = mysql_fetch_assoc($result7)) {
$reas = $row7['reas'];
$timeb = $row7['time'];
$tban = $row7['tban'];
$tip = $row7['ipd'];
};
if($timeb == "perm"){
$bant = "Permanent";
}else{
$bant = $timeb;
};
$checkusrdel = mysql_query("SELECT * FROM users WHERE username = '".$un9."'") or die(mysql_error());
if(mysql_num_rows($checkusrdel) != 0){
$acdel = "n";
}else{
$acdel = "y";
};
if(empty($tip) && acdel == "n"){
$bank = "account ban";
}else if($acdel == "y" && empty($tip)){
$bank = "account deleted";
}else if($acdel == "y" && $tip){
$bank = "account deleted + IP ban";
}else{
$bank = "account ban + IP ban";
};
$notice = '<script type="text/javascript">alert("You have been banned, as followed: "'.$bank.'". Your ban lasts until "'.$bant.'"."); window.open("login.php","_self");</script>';
};
你得到了什麼結果,你期望得到什麼結果?這將有助於瞭解,因爲我們不能看到你的數據庫表包含什麼。 – 2011-04-24 13:21:35
我沒有得到結果,這是問題。該頁面整體運行良好,但無論出於什麼原因,它都不會提示它應該發出的通知,並且只是讓我登錄。 – 2011-04-24 13:25:03
因此,我們可以假設肯定有**是帶有'bans.usr =表中的'gdscei''和bans.usr是獨一無二的? – 2011-04-24 13:30:05