Home >> Snippet List >> Snippet

Name
Block IP Addresses
Description
The above code creates an array of IP address to be blocked and checks the incoming address with array When an IP is matched, it will simply redirect to the address given (http://wwwmicrosoftcom/)
PHP Snippet
<?php
 
$denyIP = array("IP Address 1", "IP Address 2", "IP Address 3");
 
IF (in_array ($_SERVER['REMOTE_ADDR'], $denyIP)) {
    header(”location: http://www.microsoft.com/);
    EXIT();
} 
 
?>