ÓÃPHPʵÏÖÑéÖ¤Â빦ÄÜ

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

×÷Õß:hutuworm À´Ô´:ºýÍ¿²oËÂ
£ £ Ä¿Ç°£¬²»ÉÙÍøվΪÁËÀÖ¹Óû§ÀuÓûuÆ÷ÈË×Ô¶¯×¢²a¡¢µÇ¼¡¢¹aË®£¬¶¼²ÉÓÃÁË
ÑeÖ¤Âe¼¼Êo¡£ËuνÑeÖ¤Âe£¬¾ÍÊǽ«Ò»´®Ëae»u²uÉuµÄÊý×Ö»o
uºÅ£¬Éu³ÉÒ»uͼƬ£¬
ͼƬÀi¼ÓÉÏÒ»Ð(C)¸ÉÈÅÏoËØ£¨
ÀÖ¹OCR£(C)£¬ÓÉÓû§ÈaÑÛʶ±ðÆaÖеÄÑeÖ¤ÂeÐÅÏ¢£¬Êa
Èe±iµ¥Ìa½»ÍøÕ¾ÑeÖ¤£¬ÑeÖ¤³É¹¦ºo²ÅÄÜʹÓÃijÏi¹¦ÄÜ¡£

£ £ ÎÒÃÇÕaÀiչʾÁËÈçºÎ±aдPHP³ÌÐoʵÏÖÑeÖ¤Âe¹¦ÄÜ£º

£ £ ´uÂeÒ»£º

<?php   

/*

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

//ÑeÖ¤Óû§ÊaÈeÊÇ*ñºÍÑeÖ¤ÂeÒ»ÖÂ
if(isset($HTTP_POST_VARS['authinput']))
{
if(strcmp($HTTP_POST_VARS['authnum'],$HTTP_POST_VARS['authinput'])==0)
echo "ÑeÖ¤³É¹¦£¡";
else
echo "Ñe֤ʧ°Ü£¡";
}

//Éu³ÉеÄËÄλÕuÊýÑeÖ¤Âe
while(($authnum=rand()%10000)<1000);
?>

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

£ £ ´uÂe¶þ£º

<?php
/*

//É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'], $black);

    for($i=0;$i<50;$i++)   //¼ÓÈe¸ÉÈÅÏoËØ   
    {   
            imagesetpixel($im, rand()%70 , rand()%30 , $black);   
    } 

    ImagePNG($im);   
    ImageDestroy($im);   

£ £ ?>

£ £ ±¾ÎijÌÐoÔÚApache 2.0.45 + PHP 4.3.1»*¾³ÏÂÔËÐÐͨ¹ý¡£

ÉÏÎÄÖ»ÊǶÔÑeÖ¤Âe¹¦ÄܵÄÒ»¸o¼oµ¥ÊµÏÖ£¬²¢Ã»Óп¼ÂÇÉÌÓð²È«ÐÔÎÊÌa¡£Èç¹uÒªÔoÇ¿°²È«ÐÔ£¬½«´Ë¹¦ÄÜͶÈeÉÌÒµÓ¦Óã¬Ôo¿ÉÒÔͨ¹ýÒÔϼ¸¸o²½ÖeʵÏÖ£º

1. ÆoÓÃSession¡£
2. authnumÔÚauthimg.phpÖÐÉu³É£¬²¢¼ÆËamd5sum£¬´aeÈesession¡£
3. authpage.php½«authinput¼ÆËamd5sumºo£¬ÓesessionÖеÄauthnum£¨md5sum£(C)¶Ô±ÈµÃ³oÑeÖ¤½a¹u¡£

±¾Õ¾×¢£º×÷ÕßʹÓÃÁ˼oµ¥µÄ´uÂeʵÏÖÁ˺ܿaµÄ¹¦ÄÜ¡£²»¹ýÔÚÌi¼Ó¸ÉÈÅÏñËØʱµÄЧ¹u²»ÊÇÌ«ºÃ£¬´o¼Ò¿ÉÒÔ¿´Ò»ÏÂÓeÉuÂÛ̳µÇ¼ʱµÄЧÑeÂe(http://ror.cn/perl/ut/user_login.cgi)£¬Å¼°ÑµÚ¶þ¶Î´uÂeÉÔ¸ÄÁËһϣ¬Éu³ÉÁËÓeÆaÀaËƵÄЧ¹u¡£

Ð޸ĺoµÄ´uÂeÈçÏ£º

<?php
/*

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8