LXBLOGÓû§ÃÜÂëÒѸü¸Ä »ò Õ¾µã¿ªÆôÁ˰²È«ÈÏÖ¤£¬ÐèÒªÖØÐµÇ¼
2008.09.03 1:40 am »Author: keminar »PHPWINDµÄ²úÆ·×öÁËÒ»¸ö°²È«ÑéÖ¤½á¹ûÔì³ÉºÜ¶àÍøÕ¾Ö÷ºÜÀ§»óµÄÒ»¼þÊ£¬ÔÚÕ¾µãÕûºÏʱÈÝÒ׳öÏÖÈçÏÂÌáʾ£º
Óû§ÃÜÂëÒѸü¸Ä »ò Õ¾µã¿ªÆôÁ˰²È«ÈÏÖ¤£¬ÐèÒªÖØÐµÇ¼£¡Èç¹ûÄúÎÞ·¨Í˳ö£¬ÇëµãÑ¡IE ¹¤¾ß => Ñ¡ÏȻºóÊÖ¶¯Çå³ýCOOKIE
´úÂë¼ûglobal.php 334ÐÐUser_infoº¯Êý
-
-
if (!$rt || PwdCode($rt['password']) != $windpwd || $loginout==1) {
-
ÎÒ¸ù¾ÝÐèÒª£¬²»ÑéÖ¤ÃÜÂëÊÇ·ñ¸Ä±ä£¬ËùÒÔÉÏÃæ´úÂë¸ÄΪ
-
-
if (!$rt || $loginout==1) {
-
ÒÔºó¸ÄÃÜÂë¾Í²»»á³öÏÖÄǸöÌáʾÁË¡£
file_get_contents('php://input')
2008.09.02 10:31 am »Author: keminar »Ö§³ÖµÄÐÒ飯·â×°ÐÒéÁбí
Àý1.
You can decompress (gzip) a input stream by combining wrappers:
eg: $x = file_get_contents("compress.zlib://php://input");
I used this method to decompress a gzip stream that was pushed to my webserver
I find using file_get_contents with php://input is very handy and efficient. Here is the code:
Àý2.
$request = "";
$request = file_get_contents("php://input");
I don't need to declare the URL filr string as "r". It automatically handles open the file with read.
I can then use this $request string to your XMLparser as data.
ucenterʵÏÖ¿çÓòµ¥µãµÇ½µÄ·½·¨
2008.08.29 11:31 am »Author: keminar »1.ÿһ¸öÓ¦Óö¼°üº¬uc_client£¬ÄÃuchome¾ÙÀý
2.uchomeµÇ½ʱ·ÃÎÊsource/do_login.php µÄgetpassportº¯Êý,getpassportͨ¹ýuc_client Ö±½ÓÁ¬ucenterµÄÊý¾Ý¿â£¬ÊµÏÖµ±Ç°Õ¾µãµÄµÇ½
3.uchomeÈ»ºóµ÷ÓÃ$ucsynlogin = uc_user_synlogin($setarr['uid']);ʵÏÖ¿çÓòµÇ½
4.ÔÚuc_user_synloginº¯ÊýÀïÔÙÓÃuc_client/client.phpµÄfsockopenÈ¥·ÃÎÊucenterϵÄindex.phpĬÈϳ¬Ê±15Ãë
5.ÔÚucenterϵÄindex.php¸ù¾ÝÇëÇóµÄmodelºÍactionºÍappidÇëÇócontrol/user.php µÄonsynloginº¯Êý
6.onsynloginº¯Êýͨ¹ýÑ»·£¬¶ÔϵͳϵÄËùÓÐÓ¦Óã¨ÔÚdata/cache/setting.php£©×öJSµ÷ÓÃÈçÏÂ
$synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']." mce_src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']."&time=".$this->time, 'ENCODE', $app['authkey'])).'"></script>';
7.·µ»Øµ½uchome.ÔÚÿ¸öÓ¦ÓÃϵÄapiĿ¼Óиöuc.phpÎļþ²éÕÒ$action == 'synlogin'ÏÂÃæÊǽøÐÐcookieÉèÖÃ
obclean();
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
ÕâÁ½ÐÐÊDZØÐëµÄ
8.ÕâÑù¾ÍÔÚËùÓÐucenterÖªµÀµÄÓ¦ÓÃÏÂÌí¼ÓÁËcookieʵÏÖÁË¿çÓòµÇ½
PHP¿ª·¢¹¤³ÌÊ¦ÃæÊÔÊÔ¾í
2008.08.28 5:59 pm »Author: keminar »1£® Çë¶ÔPOSIX·ç¸ñºÍ¼æÈÝPerl·ç¸ñÁ½ÖÖÕýÔò±í´ïʽµÄÖ÷Òªº¯Êý½øÐÐÀà±È˵Ã÷
ereg
preg_match
ereg_replace
preg_replace
2£® Çë˵Ã÷ÔÚphp.iniÖÐsafe_mode¿ªÆôÖ®ºó¶ÔÓÚPHPϵͳº¯ÊýµÄÓ°Ïì
3£® PHP5ÖÐħÊõ·½·¨º¯ÊýÓÐÄö£¬Çë¾ÙÀý˵Ã÷¸÷×ÔµÄÓ÷¨
__sleep
__wakeup
__toString
__set_state
__construct,
__destruct
__call,
__get,
__set,
__isset,
__unset
__sleep,
__wakeup,
__toString,
__set_state,
__clone
__autoload
4£® Çëд³öÈ㬲¢ËµÃ÷ÈçºÎÔÚÃüÁîÐÐÏÂÔËÐÐPHP½Å±¾£¨Ð´³öÁ½ÖÖ·½Ê½£©Í¬Ê±ÏòPHP½Å±¾´«µÝ²ÎÊý£¿
1. Php filename.php $agr1 $agr2
2. php ¨Cr ¡°¡±
5£® PHPµÄÀ¬»øÊÕ¼¯»úÖÆÊÇÔõÑùµÄ
6£®Ê¹¶ÔÏó¿ÉÒÔÏñÊý×éÒ»Ñù½øÐÐforeachÑ»·£¬ÒªÇóÊôÐÔ±ØÐëÊÇ˽ÓС£
(IteratorģʽµÄPHP5ʵÏÖ£¬Ð´Ò»ÀàʵÏÖIterator½Ó¿Ú)
7£®Çëдһ¶ÎPHP´úÂ룬ȷ±£¶à¸ö½ø³ÌͬʱдÈëͬһ¸öÎļþ³É¹¦
8£® ÓÃPHPʵÏÖÒ»¸öË«Ïò¶ÓÁÐ
9£® ʹÓÃÕýÔò±í´ïʽÌáȡһ¶Î±êʶÓïÑÔ£¨html»òxml£©´úÂë¶ÎÖÐÖ¸¶¨±êÇ©µÄÖ¸¶¨ÊôÐÔÖµ£¨Ð迼ÂÇÊôÐÔÖµ¶Ô²»¹æÔòµÄÇé¿ö£¬Èç´óСд²»Ãô¸Ð£¬ÊôÐÔÃûÖµÓëµÈºÅ¼äÓпոñµÈ£©¡£´Ë´¦¼ÙÉèÐèÌáÈ¡test±êÇ©µÄattrÊôÐÔÖµ£¬Çë×ÔÐй¹½¨°üº¬¸Ã±êÇ©µÄ´®
10£®ÇëʹÓÃsocketÏà¹Øº¯Êý£¨·Çcurl£©ÊµÏÖÈçϹ¦ÄÜ£º¹¹ÔìÒ»¸öpostÇëÇ󣬷¢Ë͵½Ö¸¶¨http serverµÄÖ¸¶¨¶Ë¿ÚµÄÖ¸¶¨ÇëÇó·¾¶£¨Èçhttp://www.example.com:8080/test£©¡£ÇëÇóÖаüº¬ÒÔϱäÁ¿£º
Óû§Ãû£¨username£©£ºÎÂÈáÒ»µ¶
ÃÜÂ루pwd£©£º&123=321&321=123&
¸öÈ˼ò½é£¨intro£©£ºHello world!
ÇÒ¸Ãhttp serverÐèÒªÒÔÏÂcookieÀ´½øÐмòµ¥µÄÓû§¶¯×÷¸ú×Ù£º
cur_query£ºyou&me
last_tm£º...£¨ÉÏ´ÎÇëÇóµÄunixʱ¼ä´Á£¬¶¨Îªµ±Ç°ÇëÇóʱ¼äǰ10·ÖÖÓ£©
cur_tm£º...£¨µ±Ç°ÇëÇóµÄunixʱ¼ä´Á£©
ÉèÖó¬Ê±Îª10Ã룬·¢³öÇëÇóºó£¬½«http serverµÄÏìÓ¦ÄÚÈÝÊä³ö¡£
Function encode($data, $sep = ¡®&¡¯){
while (list($k,$v) = each($data)) {
$encoded .= ($encoded ? "$sep" : "");
$encoded .= rawurlencode($k)."=".rawurlencode($v);
}
Return $encoded;
}
Function post($url, $post, $cookie){
$url = parse_url($url);
$post = encode($data, ¡®&¡¯);
$cookie = encode($cookieArray, ¡®;¡¯);
$fp = fsockopen($url['host'], $url['port'] ? $url['port'] : 80, $errno, $errstr, 10);
if (!$fp) return "Failed to open socket to $url[host]";
fputs($fp, sprintf("POST %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));
fputs($fp, "Host: $url[host]\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: " . strlen($encoded) . "\n");
fputs($fp, "Cookie: $cookie\n\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, "$post \n");
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
$url = ¡®http://www.example.com:8080/test¡¯;
$encoded = username=ÎÂÈáÒ»µ¶& pwd=
$post = array(
¡®username¡¯=> ¡®ÎÂÈáÒ»µ¶¡¯,
¡®pwd => ¡®&123=321&321=123&¡¯,
¡®intro => ¡®Hello world!¡¯
);
$cookie = array(
¡®cur_query¡¯ => ¡®you&me,
¡®last_tm¡¯ => time() - 600,
'cur_tm '=> time()
);
Post($url, $post, $cookie);
11£®ÄãÓÃʲô·½·¨¼ì²éPHP½Å±¾µÄÖ´ÐÐЧÂÊ£¨Í¨³£Êǽű¾Ö´ÐÐʱ¼ä£©ºÍÊý¾Ý¿âSQLµÄЧÂÊ£¨Í¨³£ÊÇÊý¾Ý¿âQueryʱ¼ä£©£¬²¢¶¨Î»ºÍ·ÖÎö½Å±¾Ö´ÐкÍÊý¾Ý¿â²éѯµÄÆ¿¾±ËùÔÚ£¿
1£®½Å±¾Ö´ÐÐʱ¼ä£¬ÆôÓÃxdebug£¬Ê¹ÓÃWinCacheGrind·ÖÎö¡£
2£®Êý¾Ý¿â²éѯ£¬mysqlʹÓÃEXPLAIN·ÖÎö²éѯ£¬ÆôÓÃslow query log¼Ç¼Âý²éѯ¡£


