63 lines
2.6 KiB
PHP

<?php
/**
* TELVERO LOG VIEWER (ENV VERSION)
*/
session_start();
require __DIR__ . '/vendor/autoload.php';
// Laad .env configuratie
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
if (!isset($_SESSION['user'])) {
die("Toegang geweigerd. Log eerst in via het dashboard.");
}
// Database connectie via ENV
$db = new mysqli($_ENV['DB_HOST'], $_ENV['DB_USER'], $_ENV['DB_PASS'], $_ENV['DB_NAME']);
if ($db->connect_error) {
die("Database connectie mislukt.");
}
$result = $db->query("SELECT * FROM sales_logs ORDER BY created_at DESC LIMIT 100");
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<title>Telvero Logs</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-slate-50 p-8 font-sans">
<div class="max-w-5xl mx-auto">
<div class="flex justify-between items-center mb-10">
<h1 class="text-3xl font-black italic text-slate-800">SALES <span class="text-blue-600">AUDIT LOGS</span></h1>
<a href="index.html" class="bg-white px-6 py-2 rounded-xl shadow-sm font-bold text-sm text-blue-600 border border-blue-100 hover:bg-blue-50 transition">Dashboard</a>
</div>
<div class="bg-white rounded-[2rem] shadow-xl overflow-hidden border border-slate-100">
<table class="w-full text-left border-collapse">
<thead>
<tr class="bg-slate-50 border-b border-slate-100 text-[10px] uppercase tracking-[0.2em] text-slate-400 font-black">
<th class="p-6">Tijdstip</th>
<th class="p-6">Agent</th>
<th class="p-6">Actie</th>
<th class="p-6">Omschrijving</th>
</tr>
</thead>
<tbody class="text-sm divide-y divide-slate-50">
<?php while($row = $result->fetch_assoc()): ?>
<tr class="hover:bg-blue-50/30 transition-colors">
<td class="p-6 text-xs font-mono text-slate-400"><?= $row['created_at'] ?></td>
<td class="p-6 font-black text-slate-700 italic underline decoration-blue-500/30"><?= htmlspecialchars($row['username']) ?></td>
<td class="p-6"><span class="px-2 py-1 bg-blue-100 text-blue-600 rounded text-[10px] font-black uppercase"><?= $row['action'] ?></span></td>
<td class="p-6 text-slate-500 italic"><?= htmlspecialchars($row['details']) ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>