User Tools

Site Tools


attendance

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
attendance [2026/01/15 09:24] adminattendance [2026/01/15 09:25] (current) admin
Line 6: Line 6:
 </html>  </html> 
  
-<?php 
-// === CONFIG === 
-$attendanceDir = DOKU_INC . 'data/attendance/'; 
-if (!is_dir($attendanceDir)) { 
-    mkdir($attendanceDir, 0755, true); 
-} 
- 
-// File name based on current month (e.g. attendance_2026_01.txt) 
-$monthKey = date('Y_m'); 
-$file = $attendanceDir . "attendance_$monthKey.txt"; 
- 
-// Handle form submission 
-if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['attendee'])) { 
-    $name = trim(strip_tags($_POST['attendee'])); 
-    if ($name !== '') { 
-        file_put_contents($file, $name . PHP_EOL, FILE_APPEND | LOCK_EX); 
-    } 
-} 
- 
-// Load existing attendance 
-$attendees = []; 
-if (file_exists($file)) { 
-    $attendees = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 
-} 
-?> 
- 
-<form method="post"> 
-    <input type="text" name="attendee" placeholder="Enter name" required> 
-    <button type="submit">Add</button> 
-</form> 
- 
-<?php if (!empty($attendees)): ?> 
-    <h3>Attendance (<?php echo date('F Y'); ?>)</h3> 
-    <ul> 
-        <?php foreach ($attendees as $person): ?> 
-            <li><?php echo htmlspecialchars($person); ?></li> 
-        <?php endforeach; ?> 
-    </ul> 
-<?php else: ?> 
-    <p>No attendance recorded yet this month.</p> 
-<?php endif; ?> 
  
attendance.1768469050.txt.gz · Last modified: 2026/01/15 09:24 by admin