-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.php
More file actions
59 lines (54 loc) · 1.3 KB
/
stats.php
File metadata and controls
59 lines (54 loc) · 1.3 KB
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
<?php
declare(strict_types=1);
require 'autoloader.php';
use lib\Databases;
$unique_visit = 0;
$total_visit = 0;
$error = null;
try {
$unique_visit = Databases::get_unique_visit_count();
$total_visit = Databases::get_unique_visit_sum();
} catch (Throwable $e) {
// Si SQLite n'est pas dispo, on évite de casser l'affichage
$count = -1; // indicateur d'erreur
$error = $e->getMessage();
}
?><!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Magic Bertrand - Méga Kitsch</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<?php if ($error): ?>
<div role="alert">
Erreur DB : <?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?>
</div>
<?php else: ?>
<div aria-live="polite" aria-atomic="true">
<table>
<thead>
<tr>
<td>Data</td>
<td>Value</td>
</tr>
</thead>
<tbody>
<tr>
<td>Unique visit</td>
<td><?php echo $unique_visit ?></td>
</tr>
<tr>
<td>Total visit</td>
<td><?php echo $total_visit ?></td>
</tr>
</tbody>
</table>
</div>
<?php endif; ?>
<main>
</main>
</body>
</html>