fix: remove duplicate old() function causing 500 on create page #58
@@ -1,9 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
$groups = $groups ?? [];
|
$groups = $groups ?? [];
|
||||||
$old = $oldInput ?? [];
|
$old = $oldInput ?? [];
|
||||||
function old(string $key, string $default = ''): string {
|
|
||||||
return htmlspecialchars($GLOBALS['old'][$key] ?? $default);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
@@ -23,13 +20,13 @@ function old(string $key, string $default = ''): string {
|
|||||||
<label for="name">Server Name *</label>
|
<label for="name">Server Name *</label>
|
||||||
<input type="text" id="name" name="name" class="form-input"
|
<input type="text" id="name" name="name" class="form-input"
|
||||||
placeholder="e.g., Production Web Server" required
|
placeholder="e.g., Production Web Server" required
|
||||||
value="<?= old('name') ?>">
|
value="<?= htmlspecialchars($old['name'] ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="group_name">Group / Category</label>
|
<label for="group_name">Group / Category</label>
|
||||||
<input type="text" id="group_name" name="group_name" class="form-input"
|
<input type="text" id="group_name" name="group_name" class="form-input"
|
||||||
placeholder="e.g., Production, Staging"
|
placeholder="e.g., Production, Staging"
|
||||||
list="groupList" value="<?= old('group_name') ?>">
|
list="groupList" value="<?= htmlspecialchars($old['group_name'] ?? '') ?>">
|
||||||
<datalist id="groupList">
|
<datalist id="groupList">
|
||||||
<?php foreach ($groups as $group): ?>
|
<?php foreach ($groups as $group): ?>
|
||||||
<option value="<?= htmlspecialchars($group) ?>">
|
<option value="<?= htmlspecialchars($group) ?>">
|
||||||
@@ -40,7 +37,7 @@ function old(string $key, string $default = ''): string {
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description">Description</label>
|
<label for="description">Description</label>
|
||||||
<textarea id="description" name="description" class="form-input" rows="3"
|
<textarea id="description" name="description" class="form-input" rows="3"
|
||||||
placeholder="Optional description of the server"><?= old('description') ?></textarea>
|
placeholder="Optional description of the server"><?= htmlspecialchars($old['description'] ?? '') ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -51,18 +48,18 @@ function old(string $key, string $default = ''): string {
|
|||||||
<label for="ip_address">IP Address / Hostname *</label>
|
<label for="ip_address">IP Address / Hostname *</label>
|
||||||
<input type="text" id="ip_address" name="ip_address" class="form-input"
|
<input type="text" id="ip_address" name="ip_address" class="form-input"
|
||||||
placeholder="e.g., 192.168.1.100 or server.example.com" required
|
placeholder="e.g., 192.168.1.100 or server.example.com" required
|
||||||
value="<?= old('ip_address') ?>">
|
value="<?= htmlspecialchars($old['ip_address'] ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ssh_port">SSH Port *</label>
|
<label for="ssh_port">SSH Port *</label>
|
||||||
<input type="number" id="ssh_port" name="ssh_port" class="form-input"
|
<input type="number" id="ssh_port" name="ssh_port" class="form-input"
|
||||||
value="<?= old('ssh_port', '22') ?>" min="1" max="65535" required>
|
value="<?= htmlspecialchars($old['ssh_port'] ?? '22') ?>" min="1" max="65535" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ssh_user">SSH User *</label>
|
<label for="ssh_user">SSH User *</label>
|
||||||
<input type="text" id="ssh_user" name="ssh_user" class="form-input"
|
<input type="text" id="ssh_user" name="ssh_user" class="form-input"
|
||||||
placeholder="e.g., root or admin" required
|
placeholder="e.g., root or admin" required
|
||||||
value="<?= old('ssh_user') ?>">
|
value="<?= htmlspecialchars($old['ssh_user'] ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user