.
*/
include_once __DIR__.'/core.php';
$pageTitle = tr('Log');
include_once AppLegacy::filepath('include|custom|', 'top.php');
echo '
'.tr('Username').' |
'.tr('Data').' |
'.tr('Stato').' |
'.tr('Indirizzo IP').' |
';
/*
LEGGO DALLA TABELLA ZZ_LOG
*/
if (auth()->user()->isAdmin()) {
$q = 'SELECT * FROM `zz_logs` ORDER BY `created_at` DESC LIMIT 0, 100';
} else {
$q = 'SELECT * FROM `zz_logs` WHERE `id_utente`='.prepare(auth()->user()['id']).' ORDER BY `created_at` DESC LIMIT 0, 100';
}
$rs = $dbo->fetchArray($q);
$n = sizeof($rs);
for ($i = 0; $i < $n; ++$i) {
$id = $rs[$i]['id'];
$id_utente = $rs[$i]['id_utente'];
$username = $rs[$i]['username'];
$ip = $rs[$i]['ip'];
$timestamp = Translator::timestampToLocale($rs[$i]['created_at']);
$status = auth()->getStatus();
if ($rs[$i]['stato'] == $status['success']['code']) {
$type = 'success';
$stato = $status['success']['message'];
} elseif ($rs[$i]['stato'] == $status['disabled']['code']) {
$type = 'warning';
$stato = $status['disabled']['message'];
} elseif ($rs[$i]['stato'] == $status['unauthorized']['code']) {
$type = 'warning';
$stato = $status['unauthorized']['message'];
} else {
$type = 'danger';
$stato = $status['failed']['message'];
}
echo '
'.$username.' |
'.$timestamp.' |
'.$stato.' |
'.$ip.' |
';
}
echo '
';
include_once AppLegacy::filepath('include|custom|', 'bottom.php');