verbings administration

This commit is contained in:
2026-02-16 14:43:15 +01:00
parent 510a248edb
commit 4a23713d31
7 changed files with 250 additions and 23 deletions

View File

@@ -0,0 +1,46 @@
<?php
/**
* app/modules/connections/swap.php
*
* Vertauscht Endpunkt A und Endpunkt B einer Verbindung.
*/
$connectionId = (int)($_GET['id'] ?? 0);
if ($connectionId <= 0) {
$_SESSION['error'] = 'Ungueltige Verbindungs-ID';
header('Location: ?module=connections&action=list');
exit;
}
$connection = $sql->single(
"SELECT id, port_a_type, port_a_id, port_b_type, port_b_id
FROM connections
WHERE id = ?",
"i",
[$connectionId]
);
if (!$connection) {
$_SESSION['error'] = 'Verbindung nicht gefunden';
header('Location: ?module=connections&action=list');
exit;
}
$sql->set(
"UPDATE connections
SET port_a_type = ?, port_a_id = ?, port_b_type = ?, port_b_id = ?
WHERE id = ?",
"sisii",
[
(string)$connection['port_b_type'],
(int)$connection['port_b_id'],
(string)$connection['port_a_type'],
(int)$connection['port_a_id'],
$connectionId
]
);
$_SESSION['success'] = 'Endpunkte wurden vertauscht';
header('Location: ?module=connections&action=list');
exit;