v0.0..1
This commit is contained in:
Thomas
2025-10-05 14:58:05 +02:00
parent df30542248
commit a184c31cca
41 changed files with 3439 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
require_once __DIR__ . '/guard.php';
require_login();
try {
$db = new PDO('sqlite:' . dirname(__DIR__) . '/data/app.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec('CREATE TABLE IF NOT EXISTS points (user_login TEXT PRIMARY KEY, display_name TEXT, points INTEGER DEFAULT 0)');
$rows = $db->query('SELECT user_login, display_name, points FROM points ORDER BY points DESC LIMIT 200')->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
die('Database error: ' . htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Loyalty Points</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrap">
<div class="card">
<h2>🏆 Loyalty Points Top</h2>
<table>
<tr>
<th>#</th>
<th>Bruger</th>
<th>Point</th>
</tr>
<?php foreach ($rows as $i => $r): ?>
<tr>
<td><?= $i + 1 ?></td>
<td>@<?= htmlspecialchars($r['display_name'] ?: $r['user_login']) ?></td>
<td><?= (int)$r['points'] ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</body>
</html>