Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'db.php';
- // Pastikan pengguna sudah login dan memiliki peran admin
- if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
- header('Location: login.php');
- exit();
- }
- // Mengambil statistik dari database
- $student_count_query = "SELECT COUNT(*) AS total_students FROM students";
- $class_count_query = "SELECT COUNT(*) AS total_classes FROM classes";
- $student_count_result = $conn->query($student_count_query);
- $class_count_result = $conn->query($class_count_query);
- $total_students = $student_count_result->fetch_assoc()['total_students'];
- $total_classes = $class_count_result->fetch_assoc()['total_classes'];
- ?>
- <!DOCTYPE html>
- <html lang="id">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="css/style.css">
- <title>Laporan Statistik</title>
- </head>
- <body>
- <header>
- <h1>Laporan Statistik</h1>
- <nav>
- <a href="dashboard.php">Dashboard</a>
- <a href="logout.php">Logout</a>
- </nav>
- </header>
- <main>
- <h2>Statistik Siswa dan Kelas</h2>
- <div class="report">
- <p><strong>Total Siswa:</strong> <?php echo $total_students; ?></p>
- <p><strong>Total Kelas:</strong> <?php echo $total_classes; ?></p>
- </div>
- <h2>Statistik Lainnya</h2>
- <!-- Tambahkan statistik lainnya sesuai kebutuhan -->
- </main>
- <footer>
- <p>© 2023 Arsip Sekolah Dasar</p>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement