IIS has (crappy) PHP support too...
Anyway, this code should work (although .htaccess is a good alternative):
<?php
$ip = getenv("REMOTE_ADDR");
$proxy = getenv("HTTP_X_FORWARDED_FOR");
if ($proxy) { // HTTP proxy used
$pos = 0;
while (($pos < strlen($proxy)) && ($proxy{$pos} != ','))
$pos++;
$ip = substr($proxy,0,$pos);
}
if ($ip == "1.2.3.4")
die("Sorry, you are not cool enough to view this page.");
?>
Just change the IP address in red to the one you wish to block.
If you want to block more than one IP address, you can use || (or) in the IF condition. If you want to block lots of them, you should probably use a better method of matching... Like using an array or something.
Or just use .htaccess.
Anyway, you can place the code at the top of the page, or perhaps under the <BODY> tag.