testphp
Differences
This shows you the differences between two versions of the page.
| testphp [2026/01/15 09:26] – created admin | testphp [2026/01/15 09:27] (current) – removed admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | <?php | ||
| - | // === CONFIG === | ||
| - | $attendanceDir = DOKU_INC . ' | ||
| - | if (!is_dir($attendanceDir)) { | ||
| - | mkdir($attendanceDir, | ||
| - | } | ||
| - | |||
| - | // File name based on current month (e.g. attendance_2026_01.txt) | ||
| - | $monthKey = date(' | ||
| - | $file = $attendanceDir . " | ||
| - | |||
| - | // Handle form submission | ||
| - | if ($_SERVER[' | ||
| - | $name = trim(strip_tags($_POST[' | ||
| - | if ($name !== '' | ||
| - | file_put_contents($file, | ||
| - | } | ||
| - | } | ||
| - | |||
| - | // Load existing attendance | ||
| - | $attendees = []; | ||
| - | if (file_exists($file)) { | ||
| - | $attendees = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); | ||
| - | } | ||
| - | ?> | ||
| - | |||
| - | <form method=" | ||
| - | <input type=" | ||
| - | <button type=" | ||
| - | </ | ||
| - | |||
| - | <?php if (!empty($attendees)): | ||
| - | < | ||
| - | <ul> | ||
| - | <?php foreach ($attendees as $person): ?> | ||
| - | < | ||
| - | <?php endforeach; ?> | ||
| - | </ul> | ||
| - | <?php else: ?> | ||
| - | <p>No attendance recorded yet this month.</ | ||
| - | <?php endif; ?> | ||
testphp.1768469178.txt.gz · Last modified: 2026/01/15 09:26 by admin