From 5f16828e2c4d777b70d395ac2a13e829fa94532a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 28 Jan 2023 22:11:36 +0100 Subject: [PATCH] enforce DARK theme to protect my eyes and also account for reverse proxies --- index.php | 16 ++++++++++++++-- templates/login.html | 2 +- templates/player.html | 2 +- templates/streamadd.html | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index db4ab22..bbea00b 100755 --- a/index.php +++ b/index.php @@ -4,6 +4,18 @@ $cookieParams['samesite'] = "Lax"; session_set_cookie_params($cookieParams); session_start(); +$ipcka = $_SERVER['REMOTE_ADDR']; + +$headers = apache_request_headers(); + +foreach ($headers as $header => $value) { + if($header == 'X-Real-IP'){ + if (!empty($value)){ + $ipcka = $value; + } + } +} + if (!empty($_SESSION["kod"]) && !empty($_SESSION['listeners']) && !empty($_SESSION['inicialy'])) { $kod = $_SESSION['kod']; @@ -103,7 +115,7 @@ else $connections[session_id()] = $temparray; file_put_contents($connsa, json_encode($connections)); - $data = 'OK: ' . date("Y.n.d H:i:s") . "," . $_POST['listeners'] . "," . $inicialy . "," . $_SERVER['REMOTE_ADDR'] . "\n"; + $data = 'OK: ' . date("Y.n.d H:i:s") . "," . $_POST['listeners'] . "," . $inicialy . "," . $ipcka . "\n"; file_put_contents($fol . 'log.txt', $data, FILE_APPEND); echo ' diff --git a/templates/streamadd.html b/templates/streamadd.html index 6a00e83..9bafa53 100755 --- a/templates/streamadd.html +++ b/templates/streamadd.html @@ -1,5 +1,5 @@ - +