
<?php
$arr1=array_merge(range(0,9),range(0,9),range(0,9));
shuffle($arr1);
$arr2=array_rand($arr1,4);
$res='';
foreach ($arr2 as $key => $value) {
	         $res.=$arr1[$value];
}
$width=100;
$hight=40;
$img=imagecreatetruecolor($width,$hight);
$color1=imagecolorallocate($img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagefilledrectangle($img,0,0,$width,$hight,$color1);
for($i=0;$i<50;$i++){ 
	$color2=imagecolorallocate($img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
	imagesetpixel($img,mt_rand(0,$width),mt_rand(0,$hight),$color2);
}
for($i=0;$i<10;$i++){ 
	$color3=imagecolorallocate($img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
	imageline($img,mt_rand(0,$width),mt_rand(0,$hight),mt_rand(0,$width),mt_rand(0,$hight),$color3);
}
$fontfile="ziti/msyh.ttc"; 

$color4=imagecolorallocate($img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagettftext($img,17,mt_rand(-10,10),14,22,$color4,$fontfile,$res);
session_start();
$_SESSION['yanzhengma']=strtolower($res);
ob_clean();
header("content-type:image/png");
imagepng($img);
imagedestroy($img); 
?>