amélioration journalisation

This commit is contained in:
Deltacms 2023-02-08 18:46:51 +01:00
parent 362852852a
commit ab6f64d511
1 changed files with 8 additions and 7 deletions

View File

@ -2659,14 +2659,15 @@ class core extends common {
exit();
}
// Journalisation
$dataLog = mb_detect_encoding(date('d\/m\/y',time()), 'UTF-8', true)
? date('d\/m\/y',time()) . ';' . date('H\:i',time()) . ';'
: utf8_encode(date('d\/m\/y',time())) . ';' . utf8_encode(date('H\:i',time())) . ';' ;
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
$dataLog .= $this->getUrl();
$dataLog .= PHP_EOL;
if ($this->getData(['config','connect','log'])) {
$time = time();
$dataLog = mb_detect_encoding(date('d\/m\/y',$time), 'UTF-8', true)
? date('d\/m\/y',$time) . ';' . date('H\:i',$time) . ';'
: utf8_encode(date('d\/m\/y',$time)) . ';' . utf8_encode(date('H\:i',$time)) . ';' ;
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
$dataLog .= $this->getUrl();
$dataLog .= PHP_EOL;
file_put_contents(self::DATA_DIR . 'journal.log', $dataLog, FILE_APPEND);
}
// Force la déconnexion des membres bannis ou d'une seconde session