function Getverify ()
{
Session_Start ();
Ob_clean (); Clear Buffer
Header ("Content-type:image/png");
$img _width=40;
$img _height=20;
Srand (Microtime () *100000);
for ($i =0; $i <4; $i + +)
{
$new _number.=dechex (rand (0,15));
}
$_session[check_auth]= $new _number;
$new _number=imagecreate ($img _width, $img _height);//Create an image
Imagecolorallocate ($new _number,255,255,255); Set the background color to white
for ($i =0; $i
<>
{
$font =mt_rand (3,5);
$x =mt_rand + $img _width* $i/4;
$y =mt_rand (1, $img _HEIGHT/4);
$color =imagecolorallocate ($new _number,mt_rand (0,100), Mt_rand (0,150), Mt_rand (0,200));//Set character color
Imagestring ($new _number, $font, $x, $y, $_session[check_auth][$i], $color);//Output character
}
Save verification Code in $_session
$_session["verify"]=$_session[check_auth];
Imagepng ($new _number);
Imagedestroy ($new _number);
}