I am trying to write an IP ban. The users IP is stored in the database. I can manually add that users IP to the banlist. Unfortunately, the following code doesn't work. I think the problem is in getting the array out of the db.
$ip = $_SERVER['REMOTE_ADDR'];
$bannedips = array();
$notBanned = true; //later used to check, if ip is banned
$sql = "SELECT ip FROM ipban";
$result = mysqli_query($conn, $result);
while($row = mysql_fetch_array($result, MYSQL_NUM)){
$bannedips[] = $row;
}
if (in_array($ip, $bannedips)) {
$notBanned = false;
}
$bannedips[] = $row['ip'];In case withMYSQL_NUM-$bannedips[] = $row[0]At least try to print your variables to see what they contain.