feat: added adminpanel with overview; added holiday page with functionality; added payout page + functionality; added notification Feature
This commit is contained in:
53
admin.php
53
admin.php
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
session_start();
|
||||
require 'config.php';
|
||||
require 'db.php';
|
||||
|
||||
// Nur Admins dürfen hier rein
|
||||
if (!$_SESSION['user']['hasRole']) {
|
||||
die("❌ Kein Zugriff!");
|
||||
}
|
||||
|
||||
// Alle offenen Benachrichtigungen laden
|
||||
$result = $dbhandle->query("
|
||||
SELECT n.id, u.discord_name, n.message, n.type, n.created_at
|
||||
FROM notifications n
|
||||
JOIN users u ON n.user_id = u.id
|
||||
WHERE n.is_read = 0
|
||||
ORDER BY n.created_at DESC
|
||||
");
|
||||
?>
|
||||
<?php require "header.php"?>
|
||||
<head>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>📢 Admin-Dashboard</h1>
|
||||
|
||||
<div id="notifications">
|
||||
<?php while ($row = $result->fetch_assoc()): ?>
|
||||
<div class="notif">
|
||||
<b><?= htmlspecialchars($row['discord_name']) ?></b>
|
||||
<?= htmlspecialchars($row['message']) ?>
|
||||
<small>(<?= $row['created_at'] ?>)</small>
|
||||
<form method="post" action="mark_as_read.php">
|
||||
<input type="hidden" name="notif_id" value="<?= $row['id'] ?>">
|
||||
<button type="submit">✔ Erledigt</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Alle 5 Sekunden nach neuen Benachrichtigungen schauen
|
||||
setInterval(() => {
|
||||
fetch('get_notifications.php')
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
document.getElementById('notifications').innerHTML = data;
|
||||
});
|
||||
}, 5000);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user