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.