// Array of allowed country codes
$allowedCountries = ['CH', 'RS'];
// Get the current server API
$api = php_sapi_name();
// Bypass geo checks for non-web server APIs
if ($api == 'fpm-fcgi' || $api == 'cli') {
return; // Early exit for CLI or FPM contexts
}
// Retrieve the country code or default to blocking access
$countryCode = $_SERVER['GEOIP_COUNTRY_CODE'] ?? 'Unknown'; // Using null coalescing operator for clarity
// Block access if the country code is not allowed
if (!in_array($countryCode, $allowedCountries)) {
header('HTTP/1.1 404 Not Found', true, 404);
exit;
}
Available on DVD | Blue-Ray Archives -
Questions, sales, support: call TOLL FREE 855-5SAILING (855-572-4546). PRESS 1 to speak to us, 5 to leave a message.
Check out SAILFLIX.COM, our new Subscription Service. Dismiss