PHP Graphical Digital Verification Code
The following code I debug all pass. Run authpage.php.
/*
* Filename:authpage.php
*/
Srand (Double) microtime () *1000000);
//Verify user input is consistent with verification code
if (isset ($_post[' authinput ') )
{
if (strcmp ($_post[' authnum '],$_post[' authinput ']) ==0)
echo "verified success! ";
Else
echo "Verification failed! ";
}
//Generate a new four-bit integer verification code
while (($authnum =rand ()%10000) <1000);
?>
----------------------------------------------------------------------------------------------------------- --
/*
* Filename:authimg.php
*/
//Generate Verification code picture
Header ("Content-type:image/png");
Srand (Double) microtime () *1000000);
$im = imagecreate (58,28);
$black = imagecolorallocate ($im, 0,0,0);
$white = imagecolorallocate ($im, 255,255,255);
$gray = imagecolorallocate ($im, 200,200,200);
Imagefill ($im, 68,30, $gray);
//Draw a four-bit integer verification code into the picture
imagestring ($im, 5, 8, $HTTP _get_vars[' Authnum '), $white);
For ($i =0; $i <50; $i + +)//add interfering pixels
{
Imagesetpixel ($im, Rand ()%70, Rand ()%30, $gray);
}
imagepng ($im);
Imagedestroy ($im);
?>
__________________
java->struts
http://www.bkjia.com/PHPjc/845133.html www.bkjia.com true http://www.bkjia.com/PHPjc/845133.html techarticle PHP Graphics Digital Verification Code The following code I debug all pass. Run authpage.php.? /* * Filename:authpage.php */srand (double) microtime () *1000000); Verify that user input is ...