added logging
All checks were successful
Build Container / docker (push) Successful in 2m7s

This commit is contained in:
2025-06-10 11:50:24 +02:00
parent 63b49dd282
commit 5df5a0ad7a
2 changed files with 58 additions and 34 deletions

View File

@@ -13,4 +13,23 @@ function renderTemplate($templatename,$variables=[],$basepath=ROOT.'/src')
ob_end_clean();
return $rendered;
}
function addToLog($data)
{
$fp = fopen(ROOT.DS.'logs'.DS.'app.log','a');
fwrite($fp,date("d.m.y H:i")."\t".$data."\n");
fclose($fp);
}
function getUserIP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}