enforce DARK theme to protect my eyes and also account for reverse proxies

This commit is contained in:
2023-01-28 22:11:36 +01:00
parent ff5ba6fe94
commit 5f16828e2c
4 changed files with 17 additions and 5 deletions

View File

@@ -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 '
<script>
@@ -113,7 +125,7 @@ else
}
else
{
$data = 'ERR: ' . date("Y.n.d H:i:s") . "," . $_POST['listeners'] . "," . $_POST['ini'] . "," . $_SERVER['REMOTE_ADDR'] . "\n";
$data = 'ERR: ' . date("Y.n.d H:i:s") . "," . $_POST['listeners'] . "," . $_POST['ini'] . "," . $ipcka . "\n";
file_put_contents($fol . 'log.txt', $data, FILE_APPEND);
$_SESSION["kod"] = '';
$_SESSION['listeners'] = '';