0

I have this code which block a certain IP, my problem is I need to block a range of IPs using this format 206.190.155.0/150. I tried it but didn't work. I search for same problem but the format is different, How can I fix it using this format?

Thanks

<?php 

$restrictedIPs = array(

'206.190.155.139'

); // array of ips which you want to block
if(in_array($_SERVER['REMOTE_ADDR'], $restrictedIPs) || in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $restrictedIPs)) {
    echo "<script>
        window.location = 'access-denied.php';
    </script>";
}

0 Answers0