<?php

//phpinfo();
/*
######################      CWB\     #######################
############################################################
CWB PRO			$Name: release_version1_0_03112006 $
Revision		$Revision: 1.2 $
Author			$Author: zelteto $
Created 03/01/03        $Date: 2006/10/19 20:17:59 $
Writed by               GraFX (webmaster@grafxsoftware.com)
Scripts Home:           http://www.grafxsoftware.com
############################################################
*/
// deschide un session
	header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
	header("Content-Type: image/jpg");
	session_start();
		if(function_exists("imagecreate"))
		{
			$im = @imagecreate(200, 50)	or die("Cannot Initialize new GD image stream");
			$chars1 = range(0, 9);
			$chars2 = range('A','Z');
			$letter = array_merge($chars1,$chars2);
			
			$r = rand(100, 255);
			$g = rand(100, 255);
			$b = rand(100, 255);
		
			$r=$g=$b=255;
			//imagecolorallocate($im, 255, 255, 255);
			
			// image bacground color
			imagecolorallocate($im, $r, $g, $b);
			// draw each horizontal with line different color
			
			
			for($i=0;$i<4;$i++)
			{
				$r = rand(100, 255);
				$g = rand(100, 255);
				$b = rand(100, 255);
				
				$col_poly = imagecolorallocate($im, $r, $g, $b);
				imageline($im,0, 10+$i*10,120,10+$i*10,$col_poly);
			}
			// draw each vertical line with different color
			for($i=0;$i<12;$i++)
			{
				$r = rand(100, 255);
				$g = rand(100, 255);
				$b = rand(100, 255);
				
				$col_poly = imagecolorallocate($im, $r, $g, $b);
				imageline($im,10+$i*10, 0,10+$i*10,50,$col_poly);
			}
		
			$col = imagecolorallocatealpha($im, 68, 222, 137, 0); // create border color
			imagerectangle($im, 0, 0, 120, 49, $col);// draw border	
			$image_name = "";
			// draw each letter with different color
			for($i=0;$i<5;$i++)
			{
				$j = rand(0,sizeof($letter)-1);
				$r = rand(10, 140);
				$g = rand(10, 140);
				$b = rand(10, 140);
				$text_color = imagecolorallocate($im, $r, $g, $b);				
				imagettftext($im, 20, rand(0,10),5+$i*23,rand(30,50),$text_color,"embosst1.ttf",$letter[$j]);
				$image_name .= $letter[$j];
				// kepnev
			}
			
			//$tmpfname = tempnam("/tmp", "FOO").'.jpg';						
			imagejpeg($im,"",80);
			
		 //imagejpeg($thumb,"",$quality);
		 imagedestroy($im);
		 $_SESSION["verify_image"]=$image_name;
		
	}
	
	

?>