diff options
Diffstat (limited to 'Html/admin/logs.php')
-rw-r--r-- | Html/admin/logs.php | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/Html/admin/logs.php b/Html/admin/logs.php new file mode 100644 index 0000000..0bd7652 --- /dev/null +++ b/Html/admin/logs.php @@ -0,0 +1,95 @@ +<?php +require_once('../includes/config.php'); + +if(!$user->is_logged_in()) { + header('Location: login.php'); +} + +//Il n'y a que l'admin qui accède à cette page +if(isset($_SESSION['userid'])) { + if($_SESSION['userid'] != 1) { + header('Location: '.SITEURL); + } +} + +$pagetitle = 'Page de logs du site'; + +include_once('../includes/header.php'); + +?> + +<body> + +<div id="container"> + + <?php + include_once('../includes/header-logo.php'); + include_once('../includes/nav.php'); + ?> + + <div id="body"> + + <div id="content"> + + <?php + include_once('menu.php'); + ?> + + + <table style="width:100%;"> + <th>Id</th> + <th>Remote adresse</th> + <th>Resquest uri</th> + <th>Message</th> + <th>Date log</th> + + <?php + try { + //Pagination + $pages = new Paginator('10','p'); + + $query = $db->query('SELECT * FROM blog_logs'); + $pages->set_total($query->rowCount()); + + //On cherche tous les logs + $query = $db->query('SELECT * FROM blog_logs ORDER BY log_id DESC '.$pages->get_limit()); + + while($logs = $query->fetch()) { + + echo '<tr style="font-size:11px;">'; + echo '<td>'.$logs['log_id'].'</td>'; + echo '<td>'.$logs['remote_addr'].'</td>'; + echo '<td>'.$logs['request_uri'].'</td>'; + echo '<td>'.$logs['message'].'</td>'; + sscanf($logs['log_date'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<td>'.$jour.'-'.$mois.'-'.$annee.'<br />à '.$heure.':'.$minute.':'.$seconde.'</td>'; + echo '</tr>'; + + } //while + + echo '</table><br />'; + echo $pages->page_links(); + + } + + catch(PDOException $e) { + echo $e->getMessage(); + } + ?> + + </div> <!-- content --> + + <?php include_once('../sidebar.php'); ?> + + <div class="clear"></div> + + </div> <!-- body --> + +</div> <!-- container --> + +<div id="footer"> + <?php include_once('../includes/footer.php'); ?> +</div> + +</body> +</html> |