<?php
	session_start();
	header("P3P: CP=\"CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR\"");
	Header("Content-type: image/JPEG");
	srand((double)microtime()*1000000);

	$im = imagecreate(45,20) or die("Cant's initialize new GD image stream!"); 
	$red = ImageColorAllocate($im, 100,100,0);
	$white = ImageColorAllocate($im, 255,255,255);
	$gray = ImageColorAllocate($im, 200,200,200);
	
	imagefill($im,0,0,$white);//ed
	
	
	$authnum = rand(1000,9999);

	$_SESSION['randval'] = $authnum;
	
	$strx=rand(0,5);

	for($i=0;$i<4;$i++)
	{
		$strpos=rand(0,5);
		$newred = ImageColorAllocate($im, rand(0,20),rand(60,80),rand(0,50));
		imagestring($im,5,$strx,$strpos, substr($authnum,$i,1), $newred);
		$strx+=rand(7,8);
	}
	
	
	for($i=0;$i<10;$i++)
	{
		$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
		imagesetpixel($im, rand()%90 , rand()%30 , $randcolor);
	}
	
	Imagejpeg($im);
	ImageDestroy($im);
?>
