Publish a graphic digit verification code. All of the following code has been debugged by myself. Run authpage. php .? ** Filename: authpage. php * srand (double) microtime () * 1000000); verify that the user input is consistent with the verification code if (the following code of iss is successfully debugged by myself. Run authpage. php.
/*
* Filename: authpage. php
*/
Srand (double) microtime () * 1000000 );
// Verify that the user input is consistent with the verification code
If (isset ($ _ POST ['authinput'])
{
If (strcmp ($ _ POST ['authnum'], $ _ POST ['authinput']) = 0)
Echo "verification successful! ";
Else
Echo "verification failed! ";
}
// Generate a new four-digit integer verification code
While ($ authnum = rand () % 10000) <1000 );
?>
Bytes -------------------------------------------------------------------------------------------------------------
/*
* Filename: authimg. php
*/
// Generate a verification code Image
Header ("Content-type: image/PNG ");
Srand (double) microtime () * 1000000 );
$ Im = imagecreate (58,28 );
$ Black = ImageColorAllocate ($ im, 0, 0 );
$ White = ImageColorAllocate ($ im, 255,255,255 );
$ Gray = ImageColorAllocate ($ im, 200,200,200 );
Imagefill ($ im, 68, 30, $ gray );
// Print the four-digit integer verification code into the image
Imagestring ($ im, 5, 10, 8, $ HTTP_GET_VARS ['authnum'], $ white );
For ($ I = 0; $ I <50; $ I ++) // add interference pixels
{
Imagesetpixel ($ im, rand () % 70, rand () % 30, $ gray );
}
ImagePNG ($ im );
ImageDestroy ($ im );
Bytes. Run authpage. php. ? /** Filename: authpage. php */srand (double) microtime () * 1000000); // verify that the user input is consistent with the verification code if (iss...