ͼÐÎÊý×ÖÑéÖ¤´úÂë

5年以前  |  阅读数:687 次  |  编程语言:PHP 

ͼÐÎÊý×ÖÑeÖ¤´uÂe Code: <?

/*

*/

srand((double)microtime()*1000000);

//ÑeÖ¤Óû§ÊaÈeÊÇ*ñºÍÑeÖ¤ÂeÒ»ÖÂ

if(isset($_POST['authinput']))

{

if(strcmp($_POST['authnum'],$_POST['authinput'])==0)

echo "ÑeÖ¤³É¹¦£¡";

else

echo "Ñe֤ʧ°Ü£¡";

}

//Éu³ÉеÄËÄλÕuÊýÑeÖ¤Âe

while(($authnum=rand()%10000)<1000);

?>

ÇeÊaÈeÑeÖ¤Âe£º

<input type=hidden name=authnum value=<? echo $authnum; ?>>

<img src=authimg.php?authnum=<? echo $authnum; ?>>

-------------------------------------------------------------------------------------------------------------

<?
/*

*/
//Éu³ÉÑeÖ¤ÂeͼƬ
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);

//½«ËÄλÕuÊýÑeÖ¤Âe»aeÈeͼƬ

imagestring($im, 5, 10, 8, $HTTP_GET_VARS['authnum'], $white);

for($i=0;$i<50;$i++) //¼ÓÈe¸ÉÈÅÏoËØ

{

imagesetpixel($im, rand()%70 , rand()%30 , $gray);

}

ImagePNG($im);

ImageDestroy($im);

£ £ ?>

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8