mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
parent
ded29631bf
commit
b455105741
@ -142,19 +142,19 @@ $ip = $_SERVER['REMOTE_ADDR'];
|
|||||||
// 'ip' query handling
|
// 'ip' query handling
|
||||||
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip'])
|
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip'])
|
||||||
{
|
{
|
||||||
if (!$bb_cfg['verify_reported_ip'] && isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
if (!$bb_cfg['verify_reported_ip'] && isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||||
{
|
{
|
||||||
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
|
||||||
if ($x_ip === $_GET['ip'])
|
if ($x_ip === $_GET['ip'])
|
||||||
{
|
{
|
||||||
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_IP);
|
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_IP);
|
||||||
if ($filteredIp !== false && ($bb_cfg['allow_internal_ip'] || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)))
|
if ($filteredIp !== false && ($bb_cfg['allow_internal_ip'] || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)))
|
||||||
{
|
{
|
||||||
$ip = $filteredIp;
|
$ip = $filteredIp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check that IP format is valid
|
// Check that IP format is valid
|
||||||
if (!verify_ip($ip))
|
if (!verify_ip($ip))
|
||||||
|
14
common.php
14
common.php
@ -37,18 +37,10 @@ header('X-Frame-Options: SAMEORIGIN');
|
|||||||
header('X-Powered-By: TorrentPier LTS Forever!');
|
header('X-Powered-By: TorrentPier LTS Forever!');
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
// Set remote address
|
// Cloudflare
|
||||||
$allowedCDNs = array(
|
if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
|
||||||
'HTTP_X_FORWARDED_FOR',
|
|
||||||
'HTTP_FASTLY_CLIENT_IP',
|
|
||||||
'HTTP_CF_CONNECTING_IP'
|
|
||||||
);
|
|
||||||
foreach ($allowedCDNs as $allowedCDN)
|
|
||||||
{
|
{
|
||||||
if (isset($_SERVER[$allowedCDN]) && filter_var($_SERVER[$allowedCDN], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))
|
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
||||||
{
|
|
||||||
$_SERVER['REMOTE_ADDR'] = $_SERVER[$allowedCDN];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get initial config
|
// Get initial config
|
||||||
|
Loading…
Reference in New Issue
Block a user