Dateien nach "/" hochladen

This commit is contained in:
2026-07-29 11:38:36 +02:00
parent c9482d5cf0
commit 0bb624c372
3 changed files with 200 additions and 94 deletions
+11
View File
@@ -5,6 +5,17 @@ $db_file = __DIR__ . '/status.sqlite';
$pdo = new PDO('sqlite:' . $db_file);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// --- Manuelle Bereinigung per Frontend ---
if (isset($_GET['action']) && $_GET['action'] === 'cleanup') {
// FEHLER BEHOBEN: Es muss $pdo heißen, nicht $db!
// Zeitabgleich gefixt: Wir nutzen datetime('now', '-2 minutes'), da der INSERT auch in UTC erfolgt.
$pdo->exec("DELETE FROM nodes WHERE last_seen < datetime('now', '-1 days')");
header('Content-Type: application/json');
echo json_encode(["status" => "success"]);
exit;
}
// Tabelle erstellen, falls nicht existent
$pdo->exec("CREATE TABLE IF NOT EXISTS nodes (
id INTEGER PRIMARY KEY AUTOINCREMENT,