module_fn('pi_control', 'table', $name); $notice = null; $error = null; if ($_SERVER['REQUEST_METHOD'] === 'POST') { require_admin(); $name = trim((string)($_POST['name'] ?? '')); $host = trim((string)($_POST['host'] ?? '')); $port = (int)($_POST['port'] ?? 22); $username = trim((string)($_POST['username'] ?? '')); $authType = trim((string)($_POST['auth_type'] ?? 'key')); $keyPath = trim((string)($_POST['key_path'] ?? '')); $password = trim((string)($_POST['password'] ?? '')); if ($name === '' || $host === '' || $username === '') { $error = 'Bitte Name, Host und Benutzer angeben.'; } else { $stmt = $pdo->prepare( 'INSERT INTO ' . $table('hosts') . ' (name, host, port, username, auth_type, key_path, password) VALUES (:name, :host, :port, :username, :auth_type, :key_path, :password)' ); $stmt->execute([ 'name' => $name, 'host' => $host, 'port' => $port > 0 ? $port : 22, 'username' => $username, 'auth_type' => $authType !== '' ? $authType : 'key', 'key_path' => $keyPath !== '' ? $keyPath : null, 'password' => $password !== '' ? $password : null, ]); $notice = 'Host gespeichert.'; } } $hosts = $pdo->query('SELECT * FROM ' . $table('hosts') . ' ORDER BY id DESC')->fetchAll(PDO::FETCH_ASSOC); ?>
Verwalte die Raspberry Pis, die du steuern möchtest.
| Name | Host | User | Port | Auth |
|---|---|---|---|---|
| Keine Hosts vorhanden. | ||||
| = e($h['name'] ?? '') ?> | = e($h['host'] ?? '') ?> | = e($h['username'] ?? '') ?> | = e((string)($h['port'] ?? 22)) ?> | = e($h['auth_type'] ?? '') ?> |