0) { // Cookie gegen DB validieren (sonst manipuliert/alt) $stmt = $db->prepare("SELECT id FROM standorte WHERE id = ? AND (aktiv = 1 OR aktiv IS NULL) LIMIT 1"); $stmt->bind_param("i", $standortId); $stmt->execute(); $res = $stmt->get_result(); $ok = ($res && $res->num_rows === 1); $stmt->close(); if ($ok) { header("Location: $startUrl"); exit; } // ungültig -> Cookie killen setcookie($cookieName, '', time() - 3600, '/'); } header("Location: $selectUrl"); exit;