gest366/log.php

100 lines
2.9 KiB
PHP

<?php
include_once(__DIR__."/core.php");
include($docroot."/lib/user_check.php");
$pageTitle = "Log";
if( file_exists($docroot."/include/custom/top.php") ){
include($docroot."/include/custom/top.php");
}
else{
include($docroot."/include/top.php");
}
?>
<div class="col-lg-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><i class="fa fa-book"></i> <?php echo _("Ultimi 100 accessi") ?></h3>
<div class="box-tools hide">
<div style="width: 150px;" class="input-group input-group-sm">
<input type="text" placeholder="Search" class="form-control pull-right" name="table_search">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<th><?php echo ("Username"); ?></th>
<th><?php echo ("Password"); ?></th>
<th><?php echo ("Data"); ?></th>
<th><?php echo ("Stato"); ?></th>
<th><?php echo ("Indirizzo IP"); ?></th>
</tr>
<?php
/*
LEGGO DALLA TABELLA ZZ_LOG
*/
if(isAdminAutenticated()) $q = "SELECT * FROM `zz_log` ORDER BY `timestamp` DESC LIMIT 0,100";
else $q = "SELECT * FROM `zz_log` WHERE `idutente`=".prepare($_SESSION["idutente"])." ORDER BY `timestamp` DESC LIMIT 0,100";
$rs = $dbo->fetchArray( $q );
$n = sizeof($rs);
for( $i=0; $i<$n; $i++ ){
$id = $rs[$i]['id'];
$idutente = $rs[$i]['idutente'];
$username = $rs[$i]['username'];
$password = $rs[$i]['password'];
$ip = $rs[$i]['ip'];
$timestamp = readDateTime($rs[$i]['timestamp']);
if ($rs[$i]['stato']==1):
$type = "success";
$stato = _("Login riuscito!");
elseif ($rs[$i]['stato']==2):
$type = "warning";
$stato = _("Utente non abilitato!");
elseif ($rs[$i]['stato']==3):
$type = "warning";
$stato = _("L'utente non ha nessun permesso impostato!");
else:
$type = "danger";
$stato = _("Autenticazione fallita!");
endif;
echo "<tr class=\"".$type."\">\n";
echo "<td>".$username."</td>\n";
echo "<td>".$password."</td>\n";
echo "<td>".$timestamp."</td>\n";
echo "<td><span class=\"label label-".$type."\">".$stato."</span></td>\n";
echo "<td>".$ip."</td>\n";
echo "</tr>\n";
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<?php
if( file_exists($docroot."/include/custom/bottom.php") ){
include($docroot."/include/custom/bottom.php");
}
else{
include($docroot."/include/bottom.php");
}
?>