圖形數字驗證程式碼
Code:
/*
* Filename: authpage.php
*/
srand(double)microtime() *1000000);
//驗證使用者輸入是否和驗證碼一致
if(isset($_POST['authinput']))
{
if(strcmp($_POST['authnum'],$_POST['authinput'])==0)
echo "驗證成功!";
else
echo "驗證失敗!";
}
//產生新的四位整數驗證碼
while(($authnum=rand() 000)
?>
----------------- -------------------------------------------------- ------------------------------------------
/*
* Filename: authimg.php
*/
//產生驗證碼圖片
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); 68,30,$gray);
//將四位整數驗證碼繪入圖片
imagestring($im, 5, 10, 8, $HTTP_GET_VARS ['authnum'], $white);
for($i=0;$i
{
imagesetpixel($im, rand()p , rand()0 , $gray);
}
ImagePNG($im);
ImageDestroy($im);
?>
http://www.bkjia.com/PHPjc/314547.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314547.htmlTechArticle圖形數字驗證程式碼Code:? /* * Filename: authpage.php */ srand(double)microtime( )*1000000); //驗證使用者輸入是否和驗證碼一致if(isset($_POST['authinput'])) { if(s...