<?
 
 $authnum2=(isset($_GET['authkey']))?$_GET['authkey']:rand(1000,9999).rand(1000,9999).rand(1000,9999);//'S1501229049'; //VASA
 $paypass='yskin112233'.date('Ymd');//date('Ymd');//
 
 $sha1code0= strtoupper(sha1($paypass.$authnum2 ) )  ;
 
 $authnum="";//substr($sha1code0,1,6);
 
// $sha1code0= substr(strtoupper(sha1($paypass.$authnum2.$authnum),1,6)) ; 
  $c=0;  
   while( strlen($authnum)<6 && $c< strlen($sha1code0)  ){
	 if($sha1code0[$c]>"/" && $sha1code0[$c]<":"){
		 $authnum .= $sha1code0[$c];
		 }
	 
	  $c++;
	 }
 // echo $authnum.'<br>';
 
 //while(($authnum=rand()%100000)<10000);
Header("Content-type: image/PNG");  
srand((double)microtime()*1000000); 
$im = imagecreate(82,20); 
$black = ImageColorAllocate($im, 0,0,0); 

$white = ImageColorAllocate($im, 255,255,255); 
$i[2] = ImageColorAllocate($im, 255,255,0); 
$i[3] = ImageColorAllocate($im, 255,0,0); 
$i[4] = ImageColorAllocate($im, 255,255,255);

$gray = ImageColorAllocate($im, 200,200,200); 

imagefill($im,68,30,$gray); 


for ($c=0;$c<strlen($authnum);$c++){
 $color=rand(2,4);
 $angle=rand(-10,10);
 $cx=5+$c*12;
 $word=substr($authnum,$c,1);
 ImageTTFText($im,14,$angle,$cx,18, $i[$color],"/www2/skybni/fonts/a.ttf",$word); 
 }

for($i=0;$i<100;$i++)   
{ 
    $randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
    imagesetpixel($im, rand()%70 , rand()%30 , $randcolor); 
} 

ImagePNG($im); 
ImageDestroy($im); 
?>
