diff --git a/admin/config/app.php b/admin/config/app.php index 6377267..7d7e397 100644 --- a/admin/config/app.php +++ b/admin/config/app.php @@ -15,4 +15,5 @@ return [ 'assets_dir' => __DIR__ . '/../../content/-assets/', 'admin_config' => __DIR__ . '/admin.json', 'log_file' => __DIR__ . '/../storage/logs/admin.log', + 'request_log' => __DIR__ . '/../storage/logs/requests.log', ]; diff --git a/admin/templates/layout.php b/admin/templates/layout.php index 1b52bfb..c092622 100644 --- a/admin/templates/layout.php +++ b/admin/templates/layout.php @@ -81,6 +81,11 @@ $layoutSidebarColor = $layoutThemeConfig['header_color'] ?? '#0a369d'; Handleiding +
Geen activiteiten geregistreerd.
+ +| Tijd | +Niveau | +IP | +Bericht | +
|---|---|---|---|
| = htmlspecialchars($log['time']) ?> | += htmlspecialchars($log['level']) ?> | += htmlspecialchars($log['ip']) ?> |
+ = htmlspecialchars($log['message']) ?> | +
Geen requests geregistreerd.
+ +| Tijd | +IP | +Pagina | +Domein | +Taal | +User agent | +Referrer | +
|---|---|---|---|---|---|---|
| = htmlspecialchars($log['time']) ?> | += htmlspecialchars($log['ip']) ?> |
+ = htmlspecialchars($log['page']) ?> | += htmlspecialchars($log['host']) ?> | += htmlspecialchars($log['lang']) ?> | += htmlspecialchars(substr($log['ua'], 0, 60)) ?>= strlen($log['ua']) > 60 ? '…' : '' ?> | += htmlspecialchars(substr($log['referrer'], 0, 40)) ?>= strlen($log['referrer']) > 40 ? '…' : '' ?> | +
Access denied.
'; + exit; +} + $cms = new CodePressCMS($config); + +// Log page view (not for media/assets) +if (!str_starts_with($path, '/-media/') && !str_starts_with($path, '/-assets/')) { + $requestLogFile = dirname(__DIR__) . '/admin/storage/logs/requests.log'; + $logger = new RequestLogger($requestLogFile); + $logger->log( + $_GET['page'] ?? $config['default_page'] ?? 'index', + $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['REMOTE_ADDR'] ?? 'cli', + $_SERVER['HTTP_USER_AGENT'] ?? '', + $_SERVER['HTTP_REFERER'] ?? '', + $_SERVER['HTTP_HOST'] ?? '', + $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '' + ); +} + $cms->render(); \ No newline at end of file