mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2025-08-03 15:28:07 +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:
@@ -244,8 +244,19 @@ if (isset($_GET['logout'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate connection IP
|
// Validate connection IP
|
||||||
if($ip_ruleset != 'OFF'){
|
if ($ip_ruleset != 'OFF') {
|
||||||
$clientIp = $_SERVER['REMOTE_ADDR'];
|
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;
|
$proceed = false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user