Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

phpÑéÖ¤Âë´úÂëʵÀý

ÎÒÃÇÔÚдÓû§ÑéÖ¤Ò³Ãæ£¬Èç×¢²á£¬µÇ¼µÄʱºò£¬ÎªÁ˼ÓÇ¿Óû§µÇ¼µÄ°²È«ÐÔ£¬Ìí¼ÓÑéÖ¤ÂëÑéÖ¤¡£
ÑéÖ¤Âëͨ¹ýGDÉú³ÉPNGͼƬ£¬²¢°Ñ$randvalËæ»úÊý×Ö¸³¸ø$_SESSION['login_check_num']£¬ÔÚͨ¹ýÓû§ÊäÈëµÄ$_POST½øÐбȽϣ¬À´ÅжÏÊÇ·ñÕýÈ·¡£´ïµ½ÐèҪʵÏֵŦÄÜ£¬ÐèÒªÐÞ¸Äphp.iniÎļþ£¬Ê¹phpÖ§³ÖGD¿â¡£
<?php
//µ÷ÓôËÒ³Ãæ£¬Èç¹ûÏÂÃæµÄʽ×Ó³ÉÁ¢£¬ÔòÉú³ÉÑéÖ¤ÂëͼƬ
if($_GET["action"]=="verifycode")
{
    rand_create();
}
//ÑéÖ¤ÂëͼƬÉú³É
function rand_create()
{
    //֪ͨä¯ÀÀÆ÷½«ÒªÊä³öPNGͼƬ
    Header("Content-type: image/PNG");
    //×¼±¸ºÃËæ»úÊý·¢ÉúÆ÷ÖÖ×Ó
    srand((double)microtime()*1000000);
    //×¼±¸Í¼Æ¬µÄÏà¹Ø²ÎÊý 
    $im = imagecreate(62,20);
    $black = ImageColorAllocate($im, 0,0,0);  //RGBºÚÉ«±êʶ·û
    $white = ImageColorAllocate($im, 255,255,255); //RGB°×É«±êʶ·û
    $gray = ImageColorAllocate($im, 200,200,200); //RGB»ÒÉ«±êʶ·û
    //¿ªÊ¼×÷ͼ   
    imagefill($im,0,0,$gray);
    while(($randval=rand()%100000)<10000);{
        $_SESSION["login_check_num"] = $randval;
        //½«ËÄλÕûÊýÑéÖ¤Âë»æÈëͼƬ
        imagestring($im, 5, 10, 3, $randval, $black);
    }
    //¼ÓÈë¸ÉÈÅÏóËØ  
    for($i=0;$i<200;$i++){
        $randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
        imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
    }
    //Êä³öÑé֤ͼƬ
    ImagePNG($im);
    //Ïú»ÙͼÏñ±êʶ·û
    ImageDestroy($im);
}
//¼ìÑéÑéÖ¤Âë
function rand_check()
{
    if($_POST["reg_rand"] == $_SE


Ïà¹ØÎĵµ£º

httpOnly cookie flag support in PHP 5.2

http://ilia.ws/archives/121-httpOnly-cookie-flag-support-in-PHP-5.2.html
Thanks to a patch from Scott
MacVicar that I've just applied to CVS, PHP 5.2 will have support for
httpOnly cookie flag. This neat little feature allows you to mark a
newly created cookie as HTTP only, another words inacce ......

phpÅäÖÃÎļþ½âÎö ÉîδÀ´

PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHPinstallations.
; By default, PHP installs itself with a configuration suitablefor
; development purposes, and *NOT* for production purposes.
; For several security-oriented considerations that should betak ......

³£ÓÃPHPº¯Êý

ÕâÊÇһЩʹÓÃÆµÂʱȽϸߵĺ¯Êý£¬ÓеÄÀ´×Ô±ðÈ˵ijÌÐò......
1.²úÉúËæ»ú×Ö·û´®º¯Êý
function random($length) {
 $hash = '';
 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
 $max = strlen($chars) - 1;
 mt_srand((double)microtime() * 1000000);
 for($ ......

PHPÕýÔò±í´ïʽÏê½â

½ñÌì»Ø¹ËÁËÏÂÕýÔòµÄ»ù±¾ÖªÊ¶¡£  ×ÜÈÝÒ×Íü£¬ÌؼÇÓÚ´Ë¡£
ÓÃÓÚÃèÊö×Ö·ûÅÅÁÐºÍÆ¥ÅäģʽµÄÒ»ÖÖÓï·¨¹æÔò¡£ËüÖ÷ÒªÓÃÓÚ×Ö·û´®µÄģʽ·Ö¸î¡¢Æ¥Åä¡¢²éÕÒ¼°Ìæ»»²Ù×÷¡£
PHPÖеÄÕýÔòº¯Êý£º
PHPÖÐÓÐÁ½Ì×ÕýÔòº¯Êý£¬Á½Õß¹¦Äܲ¶à£¬·Ö±ðΪ£º
Ò»Ì×ÊÇÓÉPCRE£¨Perl Compatible Regular Expression£©¿âÌṩµÄ¡£Ê¹ÓÓpreg_” ......

php³£ÓÃÀàÕûÀí

×ªÔØ£ºhttp://www.phpjs.cn/article_90.html
php³£ÓÃÀàÕûÀí
ʱ¼ä£º2009-12-19 20:45 À´Ô´£ºÈËÁ¦·½ ×÷Õߣºsyuanq µã»÷£º236
ÔÚʵ¼Ê¿ª·¢¹ý³Ì»á¾­³£»áÓöµ½Ò»Ð©Öظ´µÄ²Ù×÷£¬Èç¹ûÿ´Î¶¼Òª×Ô¼ºÈ¥ÊµÏÖÕâÎÞÒɼÓÖØÁË×Ô¼ºµÄ¹¤×÷Á¿£¬ÏÂÃæ¶ÔһЩ¿ÉÄܾ­³£Óõ½µÄÀà×ö¸öÕûÀí£º
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµ¥¾ÍÄÜ´´½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ