diff --git a/admin.php b/admin.php index e69de29..294d989 100644 --- a/admin.php +++ b/admin.php @@ -0,0 +1,53 @@ +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 +"); +?> + + + + + + +

📢 Admin-Dashboard

+ +
+ fetch_assoc()): ?> +
+ + + () +
+ + +
+
+ +
+ + + + diff --git a/get_notifications.php b/get_notifications.php new file mode 100644 index 0000000..d5b4be1 --- /dev/null +++ b/get_notifications.php @@ -0,0 +1,19 @@ +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 +"); + +while ($row = $result->fetch_assoc()) { + echo "
"; + echo "".htmlspecialchars($row['discord_name'])." "; + echo htmlspecialchars($row['message']); + echo " (".htmlspecialchars($row['created_at']).")"; + echo "
"; +} diff --git a/header.php b/header.php index a01cb04..abd389e 100644 --- a/header.php +++ b/header.php @@ -9,10 +9,10 @@ if (session_status() === PHP_SESSION_NONE) { ✍️ Eintragung diff --git a/holiday.php b/holiday.php new file mode 100644 index 0000000..aec2130 --- /dev/null +++ b/holiday.php @@ -0,0 +1,43 @@ +real_escape_string($_POST['grund']); + + // Urlaub eintragen + $stmt = $dbhandle->prepare("INSERT INTO urlaub (user_id, von, bis, grund) VALUES (?, ?, ?, ?)"); + $stmt->bind_param("isss", $userId, $von, $bis, $grund); + $stmt->execute(); + $stmt->close(); + + // Benachrichtigung für Admins + $message = "hat einen Urlaubsantrag gestellt: {$von} bis {$bis}."; + $notif = $dbhandle->prepare("INSERT INTO notifications (user_id, message, type) VALUES (?, ?, 'urlaub')"); + $notif->bind_param("is", $userId, $message); + $notif->execute(); + $notif->close(); + + echo "✅ Urlaub beantragt!"; +} +?> + + + + + +
+ + + + + + + +
+ + diff --git a/payout.php b/payout.php new file mode 100644 index 0000000..eb40bd3 --- /dev/null +++ b/payout.php @@ -0,0 +1,37 @@ +prepare("INSERT INTO payouts (user_id, betrag) VALUES (?, ?)"); + $stmt->bind_param("id", $userId, $betrag); + $stmt->execute(); + $stmt->close(); + + // Benachrichtigung für Admins + $message = "hat eine Auszahlung in Höhe von {$betrag}€ beantragt."; + $notif = $dbhandle->prepare("INSERT INTO notifications (user_id, message, type) VALUES (?, ?, 'payout')"); + $notif->bind_param("is", $userId, $message); + $notif->execute(); + $notif->close(); + + echo "✅ Auszahlung beantragt!"; +} +?> + + + + + +
+ + + +
+ +