View Single Post
  #8 (permalink)  
Old 13-01-08, 08:59 PM
karimali831 karimali831 is offline
Senior Member
 
Join Date: Dec 2006
Posts: 684
Send a message via MSN to karimali831
Default

Quote:
Originally Posted by SBh View Post
Code:
<?php  
$blockip = array(
'123.123.123.123'=> 'Block reason1',
'456.456.456.456'=> 'block reason2'
);

foreach($blockip as $key=>$val)
{if ($_SERVER['REMOTE_ADDR'] == $key) 
 {   
 die("You Have Been Banned because $val");
 }
}
?>
Just include this code on the start of every page of your site and set the different ban IPs along with different banning reason.
This just the basic concept of banning IP by php.
Thanks alot for this, this will come in handy some day
Reply With Quote