<?php  if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } RBAC::enforce('security.honeypot'); $secEvents = Database::fetchAll("SELECT id, action, target_type, target_id, meta, ip_address, created_at FROM events WHERE category = 9 ORDER BY created_at DESC LIMIT 25"); echo "<div class=\"panel\"><span class=\"section-label\">Security Events</span>"; if (empty($secEvents)) { echo "<div class=\"empty-state\"><span>No security events recorded.</span></div>"; } else { $headers = ["ID", "Action", "Target", "IP", "Time"]; $rows = []; foreach ($secEvents as $e) { $rows[] = [ $e["id"], UI::e($e["action"]), UI::e(($e["target_type"] ?? '') . ($e["target_id"] ? " #".$e["target_id"] : '')), UI::e($e["ip_address"] ?? ""), UI::e($e["created_at"]) ]; } echo UI::table($headers, $rows, "tbl-sec-events"); } $auditLog = Database::fetchAll("SELECT id, admin_id, action, target_type, target_id, ip_address, created_at FROM events ORDER BY created_at DESC LIMIT 25"); echo "<span class=\"section-label\">Admin Audit Log (" . count($auditLog) . ")</span>"; if (empty($auditLog)) { echo "<div class=\"empty-state\"><span>No audit records.</span></div>"; } else { $aHeaders = ["ID", "Admin", "Action", "Target", "IP", "Time"]; $aRows = []; foreach ($auditLog as $a) { $aRows[] = [ $a["id"], $a["admin_id"] ?? "-", UI::e($a["action"]), UI::e(($a["target_type"] ?? '') . ($a["target_id"] ? " #".$a["target_id"] : '')), UI::e($a["ip_address"] ?? ""), UI::e($a["created_at"]) ]; } echo UI::table($aHeaders, $aRows, "tbl-audit"); } echo "</div>"; 