-
Notifications
You must be signed in to change notification settings - Fork 0
/
logs.php
executable file
·44 lines (36 loc) · 1.12 KB
/
logs.php
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
<?php
require "includes/verify_session.php";
//On vérifie que l'utilisateur est connecté et est administrateur :
if ($_SESSION["user"]["user_role"] == 1) {
$isadmin = true;
} else {
header("Location: ./profil.php");
}
require_once "./connect.php";
// Récupérez les logs
$sql = "SELECT user_logs.*, users.username FROM user_logs JOIN users ON user_logs.user_id = users.user_id ORDER BY user_logs.action_timestamp DESC";
$query = $db->prepare($sql);
$query->execute();
$logs = $query->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Journal des actions</title>
<link rel="stylesheet" href="./CSS/style-main.css">
</head>
<body>
<?php
include_once "./includes/header.php";
include_once "./includes/nav.php";
?>
<div class="console">
<?php foreach ($logs as $log) : ?>
<p>
[<?= $log['action_timestamp'] ?>] <?= htmlspecialchars($log['username']) ?>: <?= htmlspecialchars($log['action_type']) ?> - <?= htmlspecialchars($log['description']) ?>
</p>
<?php endforeach; ?>
</div>
</body>
</html>