Tried, feasible
<? // Authimg. php
$ Isletter = False; // Whether there are letters
Session_start ();
$ Num = $ _ Get ["N"];
// Generate a verification code Image
Header ("Content-Type: image/PNG ");
$ Im = Imagecreate (6, 20 );
Srand (double) microtime () * 1000000 );
$ Red = Rand (0,200 );
$ Green = Rand (0,200 );
$ Blue = Rand (0,200 );
$ Color = Imagecolorallocate ($ im, $ red, $ green, $ blue );
$ Background = Imagecolorallocate ($ im, 255,255,255 );
Imagefill ($ im, 0, 0, $ background );
If ($ isletter)
{
$ = Substr (MD5 ($ num * 10000000000000000 );
$ B = Substr (MD5 ($ num * 10000000000000000 );
$ C = Substr (MD5 ($ num * 10000000000000000), 8, 1 );
$ D = Substr (MD5 ($ num * 10000000000000000 );
}
Else
{
$ = Substr (hexdec (MD5 ($ num * 10000000000000000 );
$ B = Substr (hexdec (MD5 ($ num * 10000000000000000 );
$ C = Substr (hexdec (MD5 ($ num * 10000000000000000 );
$ D = Substr (hexdec (MD5 ($ num * 10000000000000000), 5, 1 );
}
$ Authnum = Strtoupper ($ A. $ B. $ C. $ D );
$ _ Session ["authnum"] = $ Authnum;
Imagestring ($ im, 5, 5, 2, $ authnum, $ color );
For ($ I = 0; I I <200; $ I ++) // Add interference pixels
{
$ Randcolor = imagecolorallocate ($ im, Rand (0,255), Rand (0,255), Rand (0,255 ));
Imagesetpixel ($ im, Rand () % 70, Rand () % 30, $ randcolor );
}
Imagepng ($ IM );
Imagedestroy ($ IM );
?>