Friday, 1 July 2011

A free bit of PHP for the world.



$img_wid=728;
$img_number = imagecreate($img_wid,25);
$backcolor = imagecolorallocate($img_number,102,102,153);
$textcolor = imagecolorallocate($img_number,255,255,255);

imagefill($img_number,0,0,$backcolor);

$deny = array("94.175.230.160", "94.175.230.161","94.175.230.162","94.175.230.163","94.175.230.164","94.175.230.165","94.175.230.166","94.175.230.167","94.175.230.168","94.175.230.169","94.175.230.170","94.175.230.171","94.175.230.172","94.175.230.173","94.175.230.174","94.175.230.175","94.175.230.176","94.175.230.177","94.175.230.178","94.175.230.179","94.175.230.180","94.175.230.181","94.175.230.182","94.175.230.183","94.175.230.184","94.175.230.185","94.175.230.186","94.175.230.187","94.175.230.188","94.175.230.189","94.175.230.190","94.175.230.191");

if (in_array ($_SERVER['REMOTE_ADDR'], $deny))
{
$number = " Your in Merseyside Police and using ".$_SERVER['REMOTE_ADDR']." are you spying or slacking?";
}
else
{
$number = " Welcome";
}

$text_width = imagefontwidth(5)*strlen($number);
$x = $img_wid/2- (ceil($text_width/2));

Imagestring($img_number,5,$x,5,$number,$textcolor);

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>