| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- session_start();
- require_once "../env.inc.php";
- require_once "../access.inc.php";
- require_once "../conf.inc.php";
- require_once DIR_PHP_LAYOUTS . "header.php";
- require_once DIR_PHP_LAYOUTS . "cms.session.php";
- if (!is_readable(SERVER_LOGS)) {
- echo "Le fichier n'est pas accessible en lecture.";
- exit();
- }
- $lines = file(SERVER_LOGS);
- $search = strtolower($_GET['search'] ?? '');
- if ($search) {
- $lines = array_filter($lines, fn($line) => stripos($line, $search) !== false);
- }
- $lines = array_reverse($lines);
- ?>
- <!DOCTYPE html>
- <html lang="fr">
- <head>
- <meta charset="UTF-8">
- <title>Visualiseur de logs</title>
- <style>
- body { font-family: monospace; background: #f4f4f4; padding: 20px; }
- .error { color: red; }
- .warning { color: orange; }
- .notice { color: blue; }
- pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
- </style>
- <link rel="stylesheet" href="<?php cache::printFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") ?>">
- <script src="<?php cache::printFileWithTime("libs/bootstrap/js/bootstrap.min.js") ?>"></script>
- <script>
- setInterval(() => {
- location.reload();
- }, 5000);
- </script>
- </head>
- <body>
- <?php
- foreach (array_slice($lines, 0, 100) as $line) {
- serverLog::filtreLog($line);
- }
- ?>
- </body>
- </html>
|