<?php 
/*
	[SueamCMS] (C)2009-2010 ZMRNet Studio
	code.php by 2009-10-02 zmrnet
*/
Header("Content-type: image/PNG"); 
srand((double)microtime()*1000000);

session_start();
$_SESSION['rand_code']='';
$img = imagecreate(45,20);

$black = ImageColorAllocate($img,0,0,0);
$white = ImageColorAllocate($img,255,255,255);
$gray = ImageColorAllocate($img,200,200,200);
$green = ImageColorAllocate($img,0,255,0);
$blue = ImageColorAllocate($img,0,0,255);
$red = ImageColorAllocate($img,255,0,0);

imagefill($img,0,0,$gray);
imagefill($img,0,0,$white);

while(($rand_code=rand()%10000)<1000);

$_SESSION['rand_code']=$rand_code;

$rand_code = (string) $rand_code;

imagestring($img,5,5,3,$rand_code[0],$black);
imagestring($img,5,15,3,$rand_code[1],$blue);
imagestring($img,5,25,3,$rand_code[2],$green);
imagestring($img,5,35,3,$rand_code[3],$red);

for($i=0;$i<200;$i++){ 
	$randcolor = ImageColorallocate($img,rand(0,255),rand(0,255),rand(0,255));
	imagesetpixel($img,rand()%80,rand()%20,$randcolor);
	imagesetpixel($img,rand()%20,rand()%80,$randcolor);
}

ImagePNG($img); 
ImageDestroy($img);
?> 
