I've created the following banning system when a user logins on my site. It checks if the user is banned, and then follows a process to gather information, and finally brings up a notice and doesn't let the user login. However, this does not happen and I can login fine. Any help would be 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>';
};