MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //home/jibhires/d1.brightsolutionsindia.com/dashboard.php
<?php
// Database connection
$conn = new mysqli("localhost", "jibhires_syrma", "0*YzVc5}%l){", "employee_attendance");
$current_date = date("Y-m-d");

// Get attendance data
$sql = "SELECT e.*, a.status AS today_status
        FROM employees e
        LEFT JOIN attendance a ON e.id = a.employee_id AND a.date = '$current_date'
        ORDER BY e.section, e.level";

$employees = $conn->query($sql);
$sections = [];

// Organize by section
while ($row = $employees->fetch_assoc()) {
    $sections[$row['section']][] = $row;
}

// Calculate totals
$totals = [];
foreach ($sections as $section => $emps) {
    $totals[$section] = [
        'present' => 0,
        'planned' => 0,
        'unplanned' => 0
    ];
    
    foreach ($emps as $emp) {
        if ($emp['today_status'] == 'Present') $totals[$section]['present']++;
        if ($emp['today_status'] == 'Planned Leave') $totals[$section]['planned']++;
        if ($emp['today_status'] == 'Unplanned Leave') $totals[$section]['unplanned']++;
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Employee Dashboard</title>
    <style>
        .section { 
            margin-bottom: 30px; 
            border: 1px solid #ddd;
            padding: 15px;
            border-radius: 5px;
        }
        .section-header { 
            background-color: #f5f5f5;
            padding: 10px;
            margin-bottom: 15px;
            border-bottom: 2px solid #ddd;
        }
        .employee-card {
            display: inline-block;
            width: 180px;
            margin: 10px;
            padding: 10px;
            border: 1px solid #eee;
            text-align: center;
            vertical-align: top;
        }
        .employee-photo {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            object-fit: cover;
            margin-bottom: 10px;
        }
        .status-present { background-color: #d4edda; }
        .status-planned { background-color: #fff3cd; }
        .status-unplanned { background-color: #f8d7da; }
        .summary-box {
            display: inline-block;
            padding: 5px 10px;
            margin: 0 5px;
            border-radius: 4px;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <h1>Employee Dashboard - <?= date('d/m/Y') ?></h1>
    
    <?php foreach ($sections as $section => $employees): ?>
    <div class="section">
        <div class="section-header">
            <h2><?= $section ?></h2>
            <div>
                <span class="summary-box" style="background-color:#d4edda">
                    Present: <?= $totals[$section]['present'] ?>
                </span>
                <span class="summary-box" style="background-color:#fff3cd">
                    Planned Leave: <?= $totals[$section]['planned'] ?>
                </span>
                <span class="summary-box" style="background-color:#f8d7da">
                    Unplanned Leave: <?= $totals[$section]['unplanned'] ?>
                </span>
            </div>
        </div>
        
        <?php foreach ($employees as $employee): 
            $status_class = '';
            if ($employee['today_status'] == 'Present') $status_class = 'status-present';
            if ($employee['today_status'] == 'Planned Leave') $status_class = 'status-planned';
            if ($employee['today_status'] == 'Unplanned Leave') $status_class = 'status-unplanned';
        ?>
        <div class="employee-card <?= $status_class ?>">
            <img src="<?= $employee['photo_path'] ?>" alt="<?= $employee['name'] ?>" class="employee-photo">
            <h3><?= $employee['name'] ?></h3>
            <p>Level: <?= $employee['level'] ?></p>
            <p><strong><?= $employee['today_status'] ?: 'Not Marked' ?></strong></p>
        </div>
        <?php endforeach; ?>
    </div>
    <?php endforeach; ?>
</body>
</html>