Graphical Numeric Verification Code
Code:
/*
* Filename: authpage.php
*/
srand((double)microtime( )*1000000);
//Verify whether 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);
?>
-------------------------------------------------- -------------------------------------------------- ------------
/*
* Filename: authimg.php
*/
/ /Generate verification code image
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 the four-digit integer verification code Enter 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);
?>
http://www.bkjia.com/PHPjc/314547.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314547.htmlTechArticleGraphic digital verification code Code:? /* * Filename: authpage.php */ srand((double)microtime( )*1000000); //Verify whether the user input is consistent with the verification code if(isset($_POST['authinput'])) { if(s...