| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/wcsd/School-alert/Backup files/ |
Upload File : |
<?php
session_start();
require 'config/db.php';
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
// Fetch active alerts with school name
$stmt = $pdo->prepare("
SELECT alerts.alert_id, alerts.type, alerts.message, alerts.status, alerts.timestamp, schools.name AS school_name
FROM alerts
JOIN schools ON alerts.school_id = schools.school_id
WHERE alerts.status = 'active'
ORDER BY alerts.timestamp DESC
");
$stmt->execute();
$alerts = $stmt->fetchAll();
?>
<?php include __DIR__ . '/views/header.php'; ?>
<h2>Dashboard</h2>
<?php foreach ($alerts as $alert): ?>
<div class="alert">
<h3>Alert Type: <?= htmlspecialchars($alert['type']) ?></h3>
<p>School Name: <?= htmlspecialchars($alert['school_name']) ?></p>
<p>Message: <?= htmlspecialchars($alert['message']) ?></p>
<p><small>Timestamp: <?= $alert['timestamp'] ?></small></p>
<form action="acknowledge.php" method="POST">
<input type="hidden" name="alert_id" value="<?= $alert['alert_id'] ?>">
<button type="submit">Acknowledge</button>
</form>
</div>
<?php endforeach; ?>
<?php include __DIR__ . '/views/footer.php'; ?>