Election Dashboard
Welcome back! Here's what's happening with the current elections.
Active & Upcoming Elections
| Election Title | Period | Status | Quick Actions |
|---|---|---|---|
| No active elections found. Create one now. | |||
| School Year Election | - | ||
Check_Auth(); if ($_SESSION['Access_Level'] < 1) { header('Location: Voting_Screen.php'); exit; } $db = db(); // Handle Status Change if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_status'])) { $newStatus = $_POST['new_status']; $electionId = $_POST['election_id']; $stmt = $db->prepare("UPDATE Election_History SET Status = ? WHERE Election_ID = ?"); $stmt->execute([$newStatus, $electionId]); header("Location: Election_Dashboard.php"); exit; } // Fetch Stats $totalVoters = $db->query("SELECT COUNT(*) FROM Voters")->fetchColumn(); $totalCandidates = $db->query("SELECT COUNT(*) FROM Candidates")->fetchColumn(); $totalVotes = $db->query("SELECT COUNT(*) FROM Voters WHERE Has_Voted = 1")->fetchColumn(); // Fetch Active/Preparing/Ongoing Elections $activeElections = $db->query("SELECT * FROM Election_History WHERE Status IN ('Preparing', 'Ongoing', 'Active') ORDER BY Start_Date DESC")->fetchAll(); ?>
Welcome back! Here's what's happening with the current elections.
| Election Title | Period | Status | Quick Actions |
|---|---|---|---|
| No active elections found. Create one now. | |||
| School Year Election | - | ||