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/attendence.php
<?php
// Database connection
$conn = new mysqli("localhost", "jibhires_syrma", "0*YzVc5}%l){", "employee_attendance");
$date = date("Y-m-d");

// Process attendance submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    foreach ($_POST["attendance"] as $employee_id => $status) {
        $sql = "INSERT INTO attendance (employee_id, date, status)
                VALUES ($employee_id, '$date', '$status')
                ON DUPLICATE KEY UPDATE status='$status'";
        $conn->query($sql);
    }
    echo "<p>Attendance updated successfully!</p>";
}

// Get all employees
$employees = $conn->query("SELECT * FROM employees ORDER BY section, level");
?>

<!DOCTYPE html>
<html>
<head>
    <title>Daily Attendance</title>
    <style>
        table { border-collapse: collapse; width: 100%; }
        th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
        th { background-color: #f2f2f2; }
    </style>
</head>
<body>
    <h1>Daily Attendance - <?= date("d/m/Y") ?></h1>
    <form method="post">
        <table>
            <tr>
                <th>Name</th>
                <th>Section</th>
                <th>Level</th>
                <th>Status</th>
            </tr>
            <?php while($row = $employees->fetch_assoc()): ?>
            <tr>
                <td><?= $row["name"] ?></td>
                <td><?= $row["section"] ?></td>
                <td><?= $row["level"] ?></td>
                <td>
                    <select name="attendance[<?= $row['id'] ?>]">
                        <option value="Present">Present</option>
                        <option value="Planned Leave">Planned Leave</option>
                        <option value="Unplanned Leave">Unplanned Leave</option>
                    </select>
                </td>
            </tr>
            <?php endwhile; ?>
        </table>
        <button type="submit">Submit Attendance</button>
    </form>
</body>
</html>