Hi,
I'm creating a chat-box application and I'm trying to add IP bans, where the php code checks if the user is banned or not and then insert the chat, but even if the IP address is banned it will still insert the chat.
$ipsql = mysql_query("SELECT * FROM bans WHERE ip='$user_ip'" or die (mysql_error()));
$bancheck = mysql_num_rows($ipsql);
if($bancheck <= 0){
$sql = mysql_query("INSERT INTO chats (user_ip, user_name, chat_body, date_time)
VALUES('$user_ip','$user_name','$chat_body',now())")
or die (mysql_error());
}
Thanks,
Soccerjunki