'error', 'msg' => 'Naam ontbreekt']); exit; } $regel = date('Y-m-d H:i:s') . "|" . $naam . "|" . $mannen . "|" . $vrouwen . "\n"; file_put_contents($file, $regel, FILE_APPEND | LOCK_EX); echo json_encode(['status' => 'ok']); exit; } // ----------------------------- // LADEN // ----------------------------- if (isset($_GET['action']) && $_GET['action'] === 'load') { header('Content-Type: application/json'); $entries = []; $totaalM = 0; $totaalV = 0; if (file_exists($file)) { $regels = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($regels as $regel) { $parts = explode('|', $regel); if (count($parts) === 4) { $entries[] = [ 'tijd' => $parts[0], 'naam' => $parts[1], 'mannen' => (int)$parts[2], 'vrouwen' => (int)$parts[3] ]; $totaalM += (int)$parts[2]; $totaalV += (int)$parts[3]; } } } echo json_encode([ 'entries' => array_reverse($entries), 'totaalM' => $totaalM, 'totaalV' => $totaalV ]); exit; } ?> Duiven Teller

🐦 Duiven Teller