false, 'message' => 'Ungueltige Verbindungs-ID']); exit; } $_SESSION['error'] = 'Ungueltige Verbindungs-ID'; header('Location: ?module=connections&action=list'); exit; } $connection = $sql->single( "SELECT id FROM connections WHERE id = ?", "i", [$connectionId] ); if (!$connection) { if ($isPost) { header('Content-Type: application/json; charset=utf-8'); http_response_code(404); echo json_encode(['success' => false, 'message' => 'Verbindung nicht gefunden']); exit; } $_SESSION['error'] = 'Verbindung nicht gefunden'; header('Location: ?module=connections&action=list'); exit; } $rows = $sql->set( "DELETE FROM connections WHERE id = ?", "i", [$connectionId] ); if ($isPost) { header('Content-Type: application/json; charset=utf-8'); if ($rows > 0) { echo json_encode(['success' => true, 'message' => 'Verbindung geloescht']); } else { http_response_code(500); echo json_encode(['success' => false, 'message' => 'Verbindung konnte nicht geloescht werden']); } exit; } if ($rows > 0) { $_SESSION['success'] = 'Verbindung geloescht'; } else { $_SESSION['error'] = 'Verbindung konnte nicht geloescht werden'; } header('Location: ?module=connections&action=list'); exit;