diff --git a/v2/status.php b/v2/status.php deleted file mode 100644 index 2294798..0000000 --- a/v2/status.php +++ /dev/null @@ -1,145 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - -// Tabelle erstellen, falls nicht existent -$pdo->exec("CREATE TABLE IF NOT EXISTS nodes ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - server TEXT, - client TEXT, - status TEXT, - handshake TEXT, - last_seen DATETIME DEFAULT CURRENT_TIMESTAMP, - UNIQUE(server, client) -)"); - -// --- TEIL 1: API (Daten empfangen) --- -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $data = json_decode(file_get_contents('php://input'), true); - - if ($data && isset($data['server']) && isset($data['client'])) { - $stmt = $pdo->prepare(" - INSERT INTO nodes (server, client, status, handshake, last_seen) - VALUES (:server, :client, :status, :handshake, datetime('now')) - ON CONFLICT(server, client) - DO UPDATE SET status=:status, handshake=:handshake, last_seen=datetime('now') - "); - $stmt->execute([ - ':server' => $data['server'], - ':client' => $data['client'], - ':status' => $data['status'], - ':handshake' => $data['handshake'] - ]); - echo json_encode(["success" => true]); - } else { - http_response_code(400); - echo json_encode(["error" => "Invalid payload"]); - } - exit; -} - -// --- TEIL 2: API (Daten für Frontend ausliefern) --- -if (isset($_GET['api'])) { - header('Content-Type: application/json'); - $stmt = $pdo->query("SELECT * FROM nodes ORDER BY server, client"); - echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC)); - exit; -} - -// --- TEIL 3: HTML FRONTEND --- -?> - - -
- - -Lade Status-Daten...
-