aboutsummaryrefslogtreecommitdiff
path: root/Html/admin/logs.php
blob: 0bd76527c53ac7eed9baf7d778a3b095312e0689 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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>