This commit is contained in:
Shish 2022-07-09 23:37:43 +01:00
parent 476808db4b
commit e97198aa10
3 changed files with 21 additions and 20 deletions

View File

@ -164,14 +164,16 @@ function check_im_version(): int
* Get request IP
*/
function get_remote_addr() {
function get_remote_addr()
{
return $_SERVER['REMOTE_ADDR'];
}
/**
* Get real IP if behind a reverse proxy
*/
function get_real_ip() {
function get_real_ip()
{
$ip = get_remote_addr();
if (REVERSE_PROXY_X_HEADERS && isset($_SERVER['HTTP_X_REAL_IP'])) {
$ip = $_SERVER['HTTP_X_REAL_IP'];
@ -822,4 +824,3 @@ function generate_key(int $length = 20): string
return $randomString;
}