<?
//include dirname(__FILE__).'/../includes/config.php';
header("Content-Type: image/jpeg");

create_image();
die();

function create_image()
{
if (strtolower(substr($_SERVER[HTTP_HOST],0,4)) == 'www.'){
$servere='.'.substr($_SERVER[HTTP_HOST],4);
} else {
$servere='.'.$_SERVER[HTTP_HOST];
}
	$md5 = md5(rand(0,9999));
	$pass = substr($md5, 10, 5);
	

	setcookie('cap', md5($pass), 0, '/', $servere);
	

	$image = ImageCreate(100, 20);  


	$clr_white = ImageColorAllocate($image, 255, 255, 255);
	$clr_black = ImageColorAllocate($image, 0, 0, 0);


	imagefill($image, 0, 0, $clr_white);


	imagefontheight(15);
	imagefontwidth(15);


	imagestring($image, 5, 30, 3, $pass, $clr_black);
	

	imageline($image, 5, 1, 50, 20, $clr_black);
	imageline($image, 60, 1, 96, 20, $clr_black);


	imagejpeg($image);
	
	imagedestroy($image);
}
?>