What are the results of testing this code? & Lt ;! DOCTYPEhtmlPUBLIC & quot;-W3CDTDXHTML1.0TransitionalEN & quot; www. Taobao-transitional. dtd & quot; & gt; & lt; htmlxmlns what are the results of testing this code?
Untitled Document
Header ("Content-type: image/PNG ");
Srand (double) microtime () * 1000000); // play the next seed that generates random numbers to facilitate the use of the following random number generation
$ Im = imagecreate (); // specify the image background size.
$ Black = ImageColorAllocate ($ im, 0, 0); // you can specify three colors.
$ White = ImageColorAllocate ($ im, 255,255,255 );
$ Gray = ImageColorAllocate ($ im, 200,200,200 );
Imagefill ($ im, $ gray); // use the area filling method, set)
While ($ authnum = rand () % 100000) <10000 );
// Print the four-digit integer verification code into the image
$ _ SESSION ['yzm'] = $ authnum; // register the verification code to the session variable.
Imagestring ($ im, 5, 10, 3, $ authnum, $ black );
// Use the col color to draw the string s to the x and y coordinates of the image (0 and 0 in the upper left corner of the image ).
// If the font is 1, 2, 3, 4, or 5, use the built-in font.
For ($ I = 0; $ 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 );
?>
My result is a prompt for downloading the PNG file. after opening the file, a prompt is displayed, indicating that the image is damaged !!!
Why?
------ Solution --------------------
Head and tail, leaving only
PHP code