forked from Cavemanon/cavepaintings
format
This commit is contained in:
parent
476808db4b
commit
e97198aa10
|
@ -164,18 +164,20 @@ function check_im_version(): int
|
||||||
* Get request IP
|
* Get request IP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function get_remote_addr() {
|
function get_remote_addr()
|
||||||
|
{
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
return $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get real IP if behind a reverse proxy
|
* Get real IP if behind a reverse proxy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function get_real_ip() {
|
function get_real_ip()
|
||||||
|
{
|
||||||
$ip = get_remote_addr();
|
$ip = get_remote_addr();
|
||||||
if (REVERSE_PROXY_X_HEADERS && isset($_SERVER['HTTP_X_REAL_IP'])) {
|
if (REVERSE_PROXY_X_HEADERS && isset($_SERVER['HTTP_X_REAL_IP'])) {
|
||||||
$ip = $_SERVER['HTTP_X_REAL_IP'];
|
$ip = $_SERVER['HTTP_X_REAL_IP'];
|
||||||
if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||||
$ip = "0.0.0.0";
|
$ip = "0.0.0.0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -822,4 +824,3 @@ function generate_key(int $length = 20): string
|
||||||
|
|
||||||
return $randomString;
|
return $randomString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user