Update common.php

This commit is contained in:
Roman Kelesidis 2024-01-22 14:56:35 +07:00
parent 780ec18fdd
commit 11f833d571

View File

@ -38,15 +38,15 @@ header('X-Powered-By: TorrentPier LTS Forever!');
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
// Set remote address // Set remote address
$allowedCDNs = ['HTTP_X_FORWARDED_FOR', 'HTTP_FASTLY_CLIENT_IP', 'HTTP_CF_CONNECTING_IP']; $allowed_cdn = array('HTTP_X_FORWARDED_FOR', 'HTTP_FASTLY_CLIENT_IP', 'HTTP_CF_CONNECTING_IP');
foreach ($allowedCDNs as $allowedCDN) foreach ($allowed_cdn as $cdn)
{ {
if (isset($_SERVER[$allowedCDN]) && filter_var($_SERVER[$allowedCDN], FILTER_VALIDATE_IP)) if (isset($_SERVER[$cdn]) && filter_var($_SERVER[$cdn], FILTER_VALIDATE_IP))
{ {
$_SERVER['REMOTE_ADDR'] = $_SERVER[$allowedCDN]; $_SERVER['REMOTE_ADDR'] = $_SERVER[$cdn];
} }
} }
unset($allowedCDNs); unset($allowed_cdn);
// Get initial config // Get initial config
if (file_exists(BB_ROOT . 'library/config.local.php')) if (file_exists(BB_ROOT . 'library/config.local.php'))