"Ungültige Daten"]); exit; } // Existierende Vorschläge laden $existing = []; if (file_exists($file)) { $json = file_get_contents($file); $existing = json_decode($json, true); if (!is_array($existing)) { $existing = []; } } // Neuen Vorschlag anhängen $existing[] = $data; // Datei speichern if (file_put_contents($file, json_encode($existing, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE))) { echo json_encode(["success" => true]); } else { http_response_code(500); echo json_encode(["error" => "Konnte Datei nicht schreiben"]); } ?>