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://www.microsoft.com/).
Also see: » Censor Message Text
» Vulnerability Tester
» Ban Proxy Servers
» Bad Word Filter
» Anti-Flood Protection
» Anti-SQL Injection Function
» XSS Sanitizer Function
» Filter non-alphanumeric characters
Comment: (none)
Language: PHP
Highlight Mode: PERL
Last Modified: March 16th, 2009
|
<?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();
}
?> |