403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcsd/School-alert/Backup files/dashboard.php.123
<?php
session_start();
require 'config/db.php';

if (!isset($_SESSION['user_id'])) {
    header('Location: login.php');
    exit();
}

// Fetch all schools
$stmt = $pdo->prepare("SELECT * FROM schools ORDER BY name ASC");
$stmt->execute();
$schools = $stmt->fetchAll();

// Prepare active and resolved alerts for each school
$alerts_by_school = [];
foreach ($schools as $school) {
    // Active alerts for this school
    $stmt = $pdo->prepare("SELECT * FROM alerts WHERE school_id = ? AND status = 'active' ORDER BY timestamp DESC");
    $stmt->execute([$school['school_id']]);
    $alerts_by_school[$school['school_id']]['active'] = $stmt->fetchAll();

    // Resolved alerts for this school
    $stmt = $pdo->prepare("SELECT * FROM alerts WHERE school_id = ? AND status = 'resolved' ORDER BY timestamp DESC");
    $stmt->execute([$school['school_id']]);
    $alerts_by_school[$school['school_id']]['resolved'] = $stmt->fetchAll();

    // Adding school name to each entry
    $alerts_by_school[$school['school_id']]['school_name'] = $school['name'];
}
?>

<?php include __DIR__ . '/views/header.php'; ?>
<h2>Dashboard</h2>

<div class="dashboard-columns">
    <!-- Active Alerts Column -->
    <div class="column active-alerts">
        <h3>Active Alerts</h3>
        <?php foreach ($alerts_by_school as $school_id => $school_data): ?>
            <h4><?= htmlspecialchars($school_data['school_name']) ?></h4>
            <?php if (empty($school_data['active'])): ?>
                <p>No active alerts for this school.</p>
            <?php else: ?>
                <?php foreach ($school_data['active'] as $alert): ?>
                    <div class="alert">
                        <h4>Alert Type: <?= htmlspecialchars($alert['type']) ?></h4>
                        <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 endif; ?>
        <?php endforeach; ?>
    </div>

    <!-- Old Events Column -->
    <div class="column old-alerts">
        <h3>Old Events</h3>
        <?php foreach ($alerts_by_school as $school_id => $school_data): ?>
            <h4><?= htmlspecialchars($school_data['school_name']) ?></h4>
            <?php if (empty($school_data['resolved'])): ?>
                <p>No old events for this school.</p>
            <?php else: ?>
                <?php foreach ($school_data['resolved'] as $alert): ?>
                    <div class="alert old-alert">
                        <h4>Alert Type: <?= htmlspecialchars($alert['type']) ?></h4>
                        <p>Message: <?= htmlspecialchars($alert['message']) ?></p>
                        <p><small>Timestamp: <?= $alert['timestamp'] ?></small></p>
                    </div>
                <?php endforeach; ?>
            <?php endif; ?>
        <?php endforeach; ?>
    </div>
</div>

<?php include __DIR__ . '/views/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit