- add connection delete endpoint and update connection list handling - expand dashboard visualization behavior - update helpers/header and project TODO tracking
42 lines
877 B
PHP
42 lines
877 B
PHP
<?php
|
|
/**
|
|
* app/modules/connections/delete.php
|
|
*
|
|
* Loescht eine Verbindung und leitet zur Liste zurueck.
|
|
*/
|
|
|
|
$connectionId = (int)($_GET['id'] ?? $_POST['id'] ?? 0);
|
|
|
|
if ($connectionId <= 0) {
|
|
$_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) {
|
|
$_SESSION['error'] = 'Verbindung nicht gefunden';
|
|
header('Location: ?module=connections&action=list');
|
|
exit;
|
|
}
|
|
|
|
$rows = $sql->set(
|
|
"DELETE FROM connections WHERE id = ?",
|
|
"i",
|
|
[$connectionId]
|
|
);
|
|
|
|
if ($rows > 0) {
|
|
$_SESSION['success'] = 'Verbindung geloescht';
|
|
} else {
|
|
$_SESSION['error'] = 'Verbindung konnte nicht geloescht werden';
|
|
}
|
|
|
|
header('Location: ?module=connections&action=list');
|
|
exit;
|