Display some field values again after submission
This commit is contained in:
parent
0c15676520
commit
3436d0243f
9 changed files with 42 additions and 68 deletions
|
@ -13,12 +13,12 @@ if ($_POST['dt'] !== '2' AND $_POST['dt'] !== '4')
|
|||
if (preg_match('/^(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{96})$/D', $_POST['key']) !== 1)
|
||||
output(403, 'Wrong value for <code>key</code>.');
|
||||
|
||||
regCheckDomainPossession($_POST['zone']);
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
|
||||
rateLimit();
|
||||
|
||||
knotcZoneExec(regParseDomain($_POST['zone'])['suffix'], [
|
||||
$_POST['zone'],
|
||||
knotcZoneExec(regParseDomain($_POST['domain'])['suffix'], [
|
||||
$_POST['domain'],
|
||||
CONF['reg']['ttl'],
|
||||
'DS',
|
||||
$_POST['keytag'],
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
regCheckDomainPossession($_POST['suffix']);
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
|
||||
rateLimit();
|
||||
|
||||
knotcZoneExec(regParseDomain($_POST['suffix'])['suffix'], [
|
||||
formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']),
|
||||
knotcZoneExec(regParseDomain($_POST['domain'])['suffix'], [
|
||||
formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['domain']),
|
||||
CONF['reg']['ttl'],
|
||||
checkIpFormat($_POST['ip']),
|
||||
$_POST['ip']
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<label for="action"><?= _('Action') ?></label>
|
||||
<select name="action" id="action">
|
||||
<option value="add"><?= _('Add') ?></option>
|
||||
<option value="delete"><?= _('Delete') ?></option>
|
||||
<option value="add"<?= ($_POST['action'] ?? NULL) === 'add' ? ' selected=""' : '' ?>><?= _('Add') ?></option>
|
||||
<option value="delete"<?= ($_POST['action'] ?? NULL) === 'delete' ? ' selected=""' : '' ?>><?= _('Delete') ?></option>
|
||||
</select>
|
||||
|
||||
<fieldset>
|
||||
|
@ -9,18 +9,19 @@
|
|||
<div>
|
||||
<label for="subdomain"><?= _('Subdomain') ?></label>
|
||||
<br>
|
||||
<input id="subdomain" size="16" placeholder="www" pattern="^(([a-z0-9_-]{1,63}\.?){1,127})|(@){1}$" name="subdomain" type="text">
|
||||
<input id="subdomain" size="16" placeholder="www" pattern="^(([a-z0-9_-]{1,63}\.?){1,127})|(@){1}$" name="subdomain" type="text" value="<?= htmlspecialchars($_POST['subdomain'] ?? '') ?>">
|
||||
</div>
|
||||
<div>
|
||||
<label for="zone"><?= _('Zone') ?></label>
|
||||
<br>
|
||||
<select required="" name="zone" id="zone">
|
||||
<option value="" disabled="" selected="">—</option>
|
||||
<?php
|
||||
foreach (nsListUserZones() as $zone)
|
||||
echo "<option value='" . $zone . "'>" . $zone . "</option>";
|
||||
$user_zones = nsListUserZones();
|
||||
if (!in_array($_POST['zone'] ?? NULL, $user_zones, true))
|
||||
echo ' <option value="" disabled="" selected="">—</option>' . LF;
|
||||
foreach ($user_zones as $zone)
|
||||
echo ' <option value="' . $zone . '"' . (($_POST['zone'] ?? NULL) === $zone ? ' selected=""' : '') . '>.' . $zone . '</option>' . LF;
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
@ -30,7 +31,7 @@ foreach (nsListUserZones() as $zone)
|
|||
<div>
|
||||
<label for="ttl-value"><?= _('Value') ?></label>
|
||||
<br>
|
||||
<input required="" id="ttl-value" list="ttls" name="ttl-value" size="6" type="number" min="1" max="432000" value="<?= DEFAULT_TTL ?>" placeholder="<?= DEFAULT_TTL ?>">
|
||||
<input required="" id="ttl-value" list="ttls" name="ttl-value" size="6" type="number" min="1" max="432000" value="<?= $_POST['ttl-value'] ?? DEFAULT_TTL ?>" placeholder="<?= DEFAULT_TTL ?>">
|
||||
<datalist id="ttls">
|
||||
<option value="900">
|
||||
<option value="1800">
|
||||
|
@ -45,10 +46,10 @@ foreach (nsListUserZones() as $zone)
|
|||
<label for="ttl-multiplier"><?= _('Unit') ?></label>
|
||||
<br>
|
||||
<select required="" name="ttl-multiplier" id="ttl-multiplier">
|
||||
<option value="1"><?= _('second') ?></option>
|
||||
<option value="60"><?= _('minute') ?></option>
|
||||
<option value="3600"><?= _('hour') ?></option>
|
||||
<option value="86400"><?= _('day') ?></option>
|
||||
<option value="1"<?= ($_POST['ttl-multiplier'] ?? NULL) === '1' ? ' selected=""' : '' ?>><?= _('second') ?></option>
|
||||
<option value="60"<?= ($_POST['ttl-multiplier'] ?? NULL) === '60' ? ' selected=""' : '' ?>><?= _('minute') ?></option>
|
||||
<option value="3600"<?= ($_POST['ttl-multiplier'] ?? NULL) === '3600' ? ' selected=""' : '' ?>><?= _('hour') ?></option>
|
||||
<option value="86400"<?= ($_POST['ttl-multiplier'] ?? NULL) === '86400' ? ' selected=""' : '' ?>><?= _('day') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
<form method="post">
|
||||
<label for="action"><?= _('Action') ?></label>
|
||||
<select name="action" id="action">
|
||||
<option value="add"><?= _('Add') ?></option>
|
||||
<option value="delete"><?= _('Delete') ?></option>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-action.inc.php'; ?>
|
||||
<br>
|
||||
<label for="zone"><?= _('Domain') ?></label>
|
||||
<br>
|
||||
<select required="" name="zone" id="zone">
|
||||
<option value="" disabled="" selected="">—</option>
|
||||
<?php
|
||||
foreach (regListUserDomains() as $domain)
|
||||
echo ' <option value="' . $domain . '">' . $domain . '</option>' . LF;
|
||||
?>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||
<br>
|
||||
<label for="keytag"><?= _('Key tag') ?></label>
|
||||
<br>
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<form method="post">
|
||||
<label for="action"><?= _('Action') ?></label>
|
||||
<select name="action" id="action">
|
||||
<option value="add"><?= _('Add') ?></option>
|
||||
<option value="delete"><?= _('Delete') ?></option>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-action.inc.php'; ?>
|
||||
<fieldset>
|
||||
<legend><?= _('Domain') ?></legend>
|
||||
<div>
|
||||
|
@ -12,15 +8,7 @@
|
|||
<input required="" id="subdomain" placeholder="ns1" name="subdomain" type="text">
|
||||
</div>
|
||||
<div>
|
||||
<label for="suffix"><?= _('Domain') ?></label>
|
||||
<br>
|
||||
<select required="" name="suffix" id="suffix">
|
||||
<option value="" disabled="" selected="">—</option>
|
||||
<?php
|
||||
foreach (regListUserDomains() as $suffix)
|
||||
echo ' <option value="' . $suffix . '">' . $suffix . '</option>' . LF;
|
||||
?>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<label for="ip"><?= _('IP address') ?></label><br>
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
<form method="post">
|
||||
<label for="action"><?= _('Action') ?></label>
|
||||
<select name="action" id="action">
|
||||
<option value="add"><?= _('Add') ?></option>
|
||||
<option value="delete"><?= _('Delete') ?></option>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-action.inc.php'; ?>
|
||||
<br>
|
||||
<label for="domain"><?= _('Domain') ?></label>
|
||||
<br>
|
||||
<select required="" name="domain" id="domain">
|
||||
<option value="" disabled="" selected="">—</option>
|
||||
<?php
|
||||
foreach (regListUserDomains() as $domain)
|
||||
echo ' <option value="' . $domain . '">' . $domain . '</option>' . LF;
|
||||
?>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||
<br>
|
||||
<label for="ns"><?= _('Name server') ?></label>
|
||||
<br>
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<form method="post">
|
||||
<label for="domain"><?= _('Domain') ?></label>
|
||||
<select required="" name="domain" id="domain">
|
||||
<option value="" disabled="" selected="">-</option>
|
||||
<?php
|
||||
foreach (regListUserDomains() as $domain)
|
||||
echo ' <option value="' . $domain . '">' . $domain . '</option>' . LF;
|
||||
?>
|
||||
</select>
|
||||
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||
<br>
|
||||
<input type="submit" value="<?= _('Display') ?>">
|
||||
</form>
|
||||
|
|
5
pg-view/reg/select-action.inc.php
Normal file
5
pg-view/reg/select-action.inc.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<label for="action"><?= _('Action') ?></label>
|
||||
<select name="action" id="action">
|
||||
<option value="add"<?= ($_POST['action'] ?? NULL) === 'add' ? ' selected=""' : '' ?>><?= _('Add') ?></option>
|
||||
<option value="delete"<?= ($_POST['action'] ?? NULL) === 'delete' ? ' selected=""' : '' ?>><?= _('Delete') ?></option>
|
||||
</select>
|
11
pg-view/reg/select-domain.inc.php
Normal file
11
pg-view/reg/select-domain.inc.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<label for="domain"><?= _('Domain') ?></label>
|
||||
<br>
|
||||
<select required="" name="domain" id="domain">
|
||||
<?php
|
||||
$user_domains = regListUserDomains();
|
||||
if (!in_array($_POST['domain'] ?? NULL, $user_domains, true))
|
||||
echo ' <option value="" disabled="" selected="">—</option>' . LF;
|
||||
foreach ($user_domains as $domain)
|
||||
echo ' <option value="' . $domain . '"' . (($_POST['domain'] ?? NULL === $domain) ? ' selected=""' : '') . '>' . $domain . '</option>' . LF;
|
||||
?>
|
||||
</select>
|
Loading…
Reference in a new issue