mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-05-08 00:26:36 +02:00
Client IP behind proxy (#665)
Function added for IP filtering when the filemanager is hosted behind a web proxy. I've added a function for this to the file, not sure how else to implement it since everything is one file.
This commit is contained in:
parent
ad30a3a1f3
commit
e474ade92b
|
@ -244,8 +244,19 @@ if (isset($_GET['logout'])) {
|
|||
}
|
||||
|
||||
// Validate connection IP
|
||||
if($ip_ruleset != 'OFF'){
|
||||
$clientIp = $_SERVER['REMOTE_ADDR'];
|
||||
if ($ip_ruleset != 'OFF') {
|
||||
function getClientIP() {
|
||||
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
|
||||
return $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
}else if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
|
||||
return $_SERVER['REMOTE_ADDR'];
|
||||
}else if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) {
|
||||
return $_SERVER['HTTP_CLIENT_IP'];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
$clientIp = getClientIP();
|
||||
|
||||
$proceed = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue