PHPÍøÕ¾³£¼û°²È«Â©¶´£¬¼°ÏàÓ¦·À·¶´ëÊ©×ܽá
Ò»¡¢³£¼ûPHPÍøÕ¾°²È«Â©¶´
¶ÔÓÚPHPµÄ©¶´£¬Ä¿Ç°³£¼ûµÄ©¶´ÓÐÎåÖÖ¡£·Ö±ðÊÇSessionÎļþ©¶´¡¢SQL×¢È멶´¡¢½Å±¾ÃüÁîÖ´ÐЩ¶´¡¢È«¾Ö±äÁ¿Â©¶´ºÍÎļþ©¶´¡£ÕâÀï·Ö±ð¶ÔÕâЩ©¶´½øÐмòÒªµÄ½éÉÜ¡£
1¡¢sessionÎļþ©¶´
Session¹¥»÷ÊǺڿÍ×î³£Óõ½µÄ¹¥»÷ÊÖ¶ÎÖ®Ò»¡£µ±Ò»¸öÓû§·ÃÎÊijһ¸öÍøվʱ£¬ÎªÁËÃâ¿Í»§Ã¿½øÈËÒ»¸öÒ³Ã涼ҪÊäÈËÕ˺źÍÃÜÂ룬PHPÉèÖÃÁËSessionºÍCookieÓÃÓÚ·½±ãÓû§µÄʹÓúͷÃÏò¡£
2¡¢SQL×¢È멶´
ÔÚ½øÐÐÍøÕ¾¿ª·¢µÄʱºò£¬³ÌÐòÔ±ÓÉÓÚ¶ÔÓû§ÊäÈËÊý¾Ýȱ·¦È«ÃæÅжϻòÕß¹ýÂ˲»Ñϵ¼Ö·þÎñÆ÷Ö´ÐÐһЩ¶ñÒâÐÅÏ¢£¬±ÈÈçÓû§ÐÅÏ¢²éѯµÈ¡£ºÚ¿Í¿ÉÒÔ¸ù¾Ý¶ñÒâ³ÌÐò·µ»ØµÄ½á¹û»ñÈ¡ÏàÓ¦µÄÐÅÏ¢¡£Õâ¾ÍÊÇÔÂÐÐθµÄSQL×¢È멶´¡£
3¡¢½Å±¾Ö´ÐЩ¶´
½Å±¾Ö´ÐЩ¶´³£¼ûµÄÔÒòÊÇÓÉÓÚ³ÌÐòÔ±ÔÚ¿ª·¢Íøվʱ¶ÔÓû§Ìá½»µÄURL²ÎÊý¹ýÂ˽ÏÉÙÒýÆðµÄ£¬Óû§Ìá½»µÄURL¿ÉÄÜ°üº¬¶ñÒâ´úÂëµ¼Ö¿çÕ¾½Å±¾¹¥»÷¡£½Å±¾Ö´ÐЩ¶´ÔÚÒÔÇ°µÄPHPÍøÕ¾Öо³£´æÔÚ£¬µ«ÊÇËæ×ÅPHP°æ±¾µÄÉý¼¶£¬ÕâЩ¼äÌâÒѾ¼õÉÙ»òÕß²»´æÔÚÁË¡£
4¡¢È«¾Ö±äÁ¿Â©¶´
PHPÖеıäÁ¿ÔÚʹÓõÄʱºò²»ÏñÆäËû¿ª·¢ÓïÑÔÄÇÑùÐèÒªÊÂÏÈÉùÃ÷£¬PHPÖеıäÁ¿¿ÉÒÔ²»¾ÉùÃ÷¾ÍÖ±½ÓʹÓã¬Ê¹ÓõÄʱºòϵͳ×Ô¶¯´´½¨£¬¶øÇÒÒ²²»ÐèÒª¶Ô±äÁ¿ÀàÐͽøÐÐ˵Ã÷£¬ÏµÍ³»á×Ô¶¯¸ù¾ÝÉÏÏÂÎÄ»·¾³×Ô¶¯È·¶¨±äÁ¿ÀàÐÍ¡£ÕâÖÖ·½Ê½¿ÉÒÔ´ó´ó¼õÉÙ³ÌÐòÔ±±à³ÌÖгö´íµÄ¸ÅÂÊ£¬Ê¹ÓÃÆðÀ´·Ç³£µÄ·½±ã¡£
5¡¢Îļþ©¶´
Îļþ©¶´Í¨³£ÊÇÓÉÓÚÍøÕ¾¿ª·¢ÕßÔÚ½øÐÐÍøÕ¾Éè¼Æʱ¶ÔÍⲿÌṩµÄÊý¾Ýȱ·¦³ä·ÖµÄ¹ýÂ˵¼ÖºڿÍÀûÓÃÆäÖеÄ©¶´ÔÚWeb½ø³ÌÉÏÖ´ÐÐÏàÓ¦µÄÃüÁî¡£¼ÙÈçÔÚlsm.phpÖаüº¬ÕâÑùÒ»¶Î´úÂë:include($b."/aaa.php".)£¬Õâ¶ÔºÚ¿ÍÀ´Ëµ£¬¿ÉÒÔͨ¹ý±äÁ¿$bÀ´ÊµÏÖÔ¶³Ì¹¥»÷£¬¿ÉÒÔÊǺڿÍ×ÔÒѵĴúÂ룬ÓÃÀ´ÊµÏÖ¶ÔÍøÕ¾µÄ¹¥»÷¡£¿ÉÒÔÏò·þÎñÆ÷Ìá½»a.php include=http://lZ7.0.0. 1/b.php,È»ºóÖ´ÐÐb.phpµÄÖ¸Áî¡£
¶þ¡¢PHP³£¼û©¶´µÄ·À·¶´ëÊ©
1¡¢¶ÔÓÚSession©¶´µÄ·À·¶
´ÓÇ°ÃæµÄ·ÖÎö¿ÉÒÔÖªµÀ£¬Session¹¥»÷×î³£¼ûµÄ¾ÍÊǻỰ½Ù³Ö£¬Ò²¾ÍÊǺڿÍͨ¹ý¸÷ÖÖ¹¥»÷ÊֶλñÈ¡Óû§µÄSession ID£¬È»ºóÀûÓñ»¹¥»÷Óû§µÄÉí·ÝÀ´µÇ¼ÏàÓ¦ÍøÕ¾¡£Îª´Ë£¬ÕâÀï¿ÉÒÔÓÃÒÔϼ¸ÖÖ·½·¨½øÐзÀ·¶:Ò»ÊǶ¨ÆÚ¸ü»»Session ID£¬¸ü»»Session ID¿ÉÒÔÓÃPHP×Ô´øº¯ÊýÀ´ÊµÏÖ;¶þÊǸü»»SessionÃû³Æ£¬Í¨³£Çé¿öÏÂSessionµÄĬÈÏÃû³ÆÊÇPHPSESSID£¬Õâ¸ö±äÁ¿Ò»°ãÊÇÔÚcookieÖб£´æµÄ£¬Èç¹û¸ü¸ÄÁËËüµÄÃû³Æ£¬¾Í¿ÉÒÔ×èµµºÚ¿ÍµÄ²¿·Ö¹¥»÷;ÈýÊǶÔ͸Ã÷»¯µÄSession ID½øÐйرմ¦Àí£¬Ëùν͸Ã÷»¯Ò²¾ÍÊÇÖ¸ÔÚhttpÇëÇóûÓÐʹÓÃcookiesÀ´Öƶ¨Session idʱ£¬Sessioin idʹÓÃÁ´½ÓÀ´´«µÝ.¹Ø±Õ͸Ã÷»¯Session ID¿ÉÒÔͨ¹ý²Ù×÷PHP.iniÎļþÀ´ÊµÏÖ;ËÄÊÇͨ¹ýURL´«µÝÒþ²Ø²ÎÊý£¬ÕâÑù¿ÉÒÔÈ·±£¼´Ê¹ºÚ¿Í»ñÈ¡ÁËsessionÊý¾Ý£¬µ«ÊÇÓÉÓÚÏà¹Ø²ÎÊýÊÇÒþ²ØµÄ£¬ËüÒ²ºÜÄÑ»ñµÃSession ID±äÁ¿Öµ¡£
2¡¢¶ÔSQL×¢È멶´µÄ·À·¶
ºÚ¿Í½øÐÐSQL×¢ÈëÊֶκܶ࣬¶øÇÒÁé»î¶à±ä£¬µ«ÊÇSQL×¢È˵Ĺ²Í¬µã¾ÍÊÇÀûÓÃÊäÈë¹ýÂË©¶´¡£Òò´Ë£¬ÒªÏë´Ó¸ù±¾ÉÏ·ÀÖ¹SQL×¢È룬¸ù±¾½â¾ö´ëÊ©¾ÍÊǼÓÇ¿¶ÔÇëÇóÃüÁîÓÈÆäÊDzéѯÇëÇóÃüÁîµÄ¹ýÂË¡£¾ßÌåÀ´Ëµ£¬°üÀ¨ÒÔϼ¸µã:Ò»ÊǰѹýÂËÐÔÓï¾ä½øÐвÎÊý»¯´¦Àí£¬Ò²¾ÍÊÇͨ¹ý²ÎÊý»¯Óï¾äʵÏÖÓû§ÐÅÏ¢µÄÊäÈë¶ø²»ÊÇÖ±½Ó°ÑÓû§ÊäÈëǶÈëµ½Óï¾äÖС£¶þÊÇÔÚÍøÕ¾¿ª·¢µÄʱºò¾¡¿ÉÄÜÉÙÓýâÊÍÐÔ³ÌÐò£¬ºÚ¿Í¾³£Í¨¹ýÕâÖÖÊÖ¶ÎÀ´Ö´ÐзǷ¨ÃüÁî;ÈýÊÇÔÚÍøÕ¾¿ª·¢Ê±¾¡¿ÉÄܱÜÃâÍøÕ¾³öÏÖbug£¬·ñÔòºÚ¿Í¿ÉÄÜÀûÓÃÕâЩÐÅÏ¢À´¹¥»÷ÍøÕ¾;½ö½öͨ¹ý·ÀÓùSQL×¢È뻹ÊDz»¹»µÄ£¬ÁíÍ⻹Ҫ¾³£Ê¹ÓÃרҵµÄ©¶´É¨Ã蹤¾ß¶ÔÍøÕ¾½øÐЩ¶´É¨Ãè¡£
3¡¢¶Ô½Å±¾Ö´ÐЩ¶´µÄ·À·¶
ºÚ¿ÍÀûÓýű¾Ö´ÐЩ¶´½øÐй¥»÷µÄÊÖ¶ÎÊǶàÖÖ¶àÑùµÄ£¬¶øÇÒÊÇÁé»î¶à±äµÄ£¬¶Ô´Ë£¬±ØÐëÒª²ÉÓöàÖÖ·À·¶·½·¨×ۺϵÄÊֶΣ¬²ÅÄÜÓÐЧ·ÀÖ¹ºÚ¿Í¶Ô½Å±¾Ö´ÐЩ¶´½øÐй¥»÷¡£ÕâÀï³£Óõķ½·¨·½·¨ÓÐÒÔÏÂËÄÖÖ¡£Ò»ÊǶԿÉÖ´ÐÐÎļþµÄ·¾¶½øÐÐÔ¤ÏÈÉ趨¡£¿ÉÒÔͨ¹ýsafe_moade_exec_dirÀ´ÊµÏÖ;¶þÊǶÔÃüÁî²ÎÊý½øÐд¦Àí£¬Ò»°ãÓÃescapeshellargº¯ÊýʵÏÖ;ÈýÊÇÓÃϵͳ×Ô´øµÄº¯Êý¿âÀ´´úÌæÍⲿÃüÁî;ËÄÊÇÔÚ²Ù×÷µÄʱºò½ø¿ÉÄܼõÉÙʹÓÃÍⲿÃüÁî¡£
4¡¢¶ÔÈ«¾Ö±äÁ¿Â©¶´·À·¶
¶ÔÓÚPHPÈ«¾Ö±äÁ¿µÄ©¶´ÎÊÌ⣬ÒÔÇ°µÄPHP°æ±¾´æÔÚÕâÑùµÄÎÊÌ⣬µ«ÊÇËæ×ÅPHP°æ±¾Éý¼¶µ½5.5ÒԺ󣬿ÉÒÔͨ¹ý¶Ôphp.iniµÄÉèÖÃÀ´ÊµÏÖ£¬ÉèÖÃruquest_orderΪGPC¡£ÁíÍâÔÚphp.iniÅäÖÃÎļþÖУ¬¿ÉÒÔͨ¹ý¶Ômagic_quotes_runtime½øÐв¼¶ûÖµÉèÖÃÊÇ·ñ¶ÔÍⲿÒýÈ˵ÄÊý¾ÝÖеÄÒç³ö×Ö·û¼Ó·´Ð±Ïß¡£ÎªÁËÈ·±£ÍøÕ¾³ÌÐòÔÚ·þÎñÆ÷µÄÈκÎÉèÖÃ״̬϶¼ÄÜÔËÐС£¿ÉÒÔÔÚÕû¸ö³ÌÐò¿ªÊ¼µÄʱºòÓÃget_magic_quotes_runtime¼ì²âÉèÖÃ״̬¾ö¶¨ÊÇ·ñÒªÊÖ¹¤´¦Àí£¬»òÕßÔÚ¿ªÊ¼(»ò²»ÐèÒª×Ô¶¯×ªÒåµÄʱºò)ÓÃset_magic_quotes_runtime(0)¹Øµô¡£
5¡¢¶ÔÎļþ©¶´µÄ·À·¶
¶ÔÓÚPHPÎļþ©ͩ¿ÉÒÔͨ¹ý¶Ô·þÎñÆ÷½øÐÐÉèÖúÍÅäÖÃÀ´´ïµ½·À·¶Ä¿µÄ¡£ÕâÀï¾ßÌåµÄ²Ù×÷ÈçÏÂ:Ò»ÊÇ°ÑPHP´úÂëÖеĴíÎóÌáʾ¹Ø±Õ£¬ÕâÑù¿ÉÒÔ±ÜÃâºÚ¿Íͨ¹ý´íÎóÌáʾ»ñÈ¡Êý¾Ý¿âÐÅÏ¢ºÍÍøÒ³ÎļþÎïÀí·¾¶;¶þÊǶÔopen_basedir¾¡ÐÄÉèÖã¬Ò²¾ÍÊǶÔĿ¼ÍâµÄÎļþ²Ù×÷½øÐнûÖ¹´¦Àí;ÕâÑù¿ÉÒÔ¶Ô±¾µØÎļþ»òÕßÔ¶³ÌÎļþÆðµ½±£»¤×÷Ó㬷ÀÖ¹ËüÃDZ»¹¥»÷£¬ÕâÀﻹҪעÒâ·À·¶SessionÎļþºÍÉÏÔØÎļþµÄ¹¥»÷;ÈýÊÇ°Ñsafe-madeÉèÖÃΪ¿ªÆô״̬£¬´Ó¶ø¶Ô½«ÒªÖ´ÐеÄÃüÁî½øÐй淶£¬Í¨¹ý½ûÖ¹ÎļþÉÏ´«£¬¿ÉÒÔÓÐЧµÄÌá¸ßPHPÍøÕ¾µÄ°²È«ÏµÊý¡£
ÉùÃ÷£º±¾ÎÄÓÉÖ£ÖÝÅú·¢Êг¡£ºhttp://www.shun-e.com/market/ Ô´´Í¶¸å£¬×ðÖØËûÈ˳ɹû£¬×ªÔØÇë×¢Ã÷³ö´¦!
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ