34705-vm/admin.php
Flatlogic Bot 2587a17d37 basic2
2025-10-06 00:19:27 +00:00

60 lines
2.1 KiB
PHP

<?php
session_start();
// Role-based access control
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
// If user is not logged in or is not an admin, redirect to homepage
header('Location: /');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard - StatTracker</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<div class="container my-5">
<header class="mb-5">
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="/">StatTracker</a>
<div id="auth-links" class="d-flex">
<!-- Auth links are injected by JS -->
</div>
</div>
</nav>
</header>
<main>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Admin Dashboard</h1>
<button id="download-users-csv" class="btn btn-success">Download Users as CSV</button>
</div>
<section id="user-management">
<h2>User Management</h2>
<div id="user-table-container" class="player-card p-4">
<!-- User table will be loaded here by admin.js -->
</div>
</section>
</main>
<footer class="footer text-center">
<p>&copy; <?php echo date("Y"); ?> StatTracker. All Rights Reserved.</p>
</footer>
</div>
<script src="assets/js/csv-export.js?v=<?php echo time(); ?>"></script>
<script src="assets/js/admin.js?v=<?php echo time(); ?>"></script>
</body>
</html>