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)
|
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>.');
|
output(403, 'Wrong value for <code>key</code>.');
|
||||||
|
|
||||||
regCheckDomainPossession($_POST['zone']);
|
regCheckDomainPossession($_POST['domain']);
|
||||||
|
|
||||||
rateLimit();
|
rateLimit();
|
||||||
|
|
||||||
knotcZoneExec(regParseDomain($_POST['zone'])['suffix'], [
|
knotcZoneExec(regParseDomain($_POST['domain'])['suffix'], [
|
||||||
$_POST['zone'],
|
$_POST['domain'],
|
||||||
CONF['reg']['ttl'],
|
CONF['reg']['ttl'],
|
||||||
'DS',
|
'DS',
|
||||||
$_POST['keytag'],
|
$_POST['keytag'],
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
regCheckDomainPossession($_POST['suffix']);
|
regCheckDomainPossession($_POST['domain']);
|
||||||
|
|
||||||
rateLimit();
|
rateLimit();
|
||||||
|
|
||||||
knotcZoneExec(regParseDomain($_POST['suffix'])['suffix'], [
|
knotcZoneExec(regParseDomain($_POST['domain'])['suffix'], [
|
||||||
formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']),
|
formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['domain']),
|
||||||
CONF['reg']['ttl'],
|
CONF['reg']['ttl'],
|
||||||
checkIpFormat($_POST['ip']),
|
checkIpFormat($_POST['ip']),
|
||||||
$_POST['ip']
|
$_POST['ip']
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<label for="action"><?= _('Action') ?></label>
|
<label for="action"><?= _('Action') ?></label>
|
||||||
<select name="action" id="action">
|
<select name="action" id="action">
|
||||||
<option value="add"><?= _('Add') ?></option>
|
<option value="add"<?= ($_POST['action'] ?? NULL) === 'add' ? ' selected=""' : '' ?>><?= _('Add') ?></option>
|
||||||
<option value="delete"><?= _('Delete') ?></option>
|
<option value="delete"<?= ($_POST['action'] ?? NULL) === 'delete' ? ' selected=""' : '' ?>><?= _('Delete') ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -9,18 +9,19 @@
|
||||||
<div>
|
<div>
|
||||||
<label for="subdomain"><?= _('Subdomain') ?></label>
|
<label for="subdomain"><?= _('Subdomain') ?></label>
|
||||||
<br>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="zone"><?= _('Zone') ?></label>
|
<label for="zone"><?= _('Zone') ?></label>
|
||||||
<br>
|
<br>
|
||||||
<select required="" name="zone" id="zone">
|
<select required="" name="zone" id="zone">
|
||||||
<option value="" disabled="" selected="">—</option>
|
|
||||||
<?php
|
<?php
|
||||||
foreach (nsListUserZones() as $zone)
|
$user_zones = nsListUserZones();
|
||||||
echo "<option value='" . $zone . "'>" . $zone . "</option>";
|
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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -30,7 +31,7 @@ foreach (nsListUserZones() as $zone)
|
||||||
<div>
|
<div>
|
||||||
<label for="ttl-value"><?= _('Value') ?></label>
|
<label for="ttl-value"><?= _('Value') ?></label>
|
||||||
<br>
|
<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">
|
<datalist id="ttls">
|
||||||
<option value="900">
|
<option value="900">
|
||||||
<option value="1800">
|
<option value="1800">
|
||||||
|
@ -45,10 +46,10 @@ foreach (nsListUserZones() as $zone)
|
||||||
<label for="ttl-multiplier"><?= _('Unit') ?></label>
|
<label for="ttl-multiplier"><?= _('Unit') ?></label>
|
||||||
<br>
|
<br>
|
||||||
<select required="" name="ttl-multiplier" id="ttl-multiplier">
|
<select required="" name="ttl-multiplier" id="ttl-multiplier">
|
||||||
<option value="1"><?= _('second') ?></option>
|
<option value="1"<?= ($_POST['ttl-multiplier'] ?? NULL) === '1' ? ' selected=""' : '' ?>><?= _('second') ?></option>
|
||||||
<option value="60"><?= _('minute') ?></option>
|
<option value="60"<?= ($_POST['ttl-multiplier'] ?? NULL) === '60' ? ' selected=""' : '' ?>><?= _('minute') ?></option>
|
||||||
<option value="3600"><?= _('hour') ?></option>
|
<option value="3600"<?= ($_POST['ttl-multiplier'] ?? NULL) === '3600' ? ' selected=""' : '' ?>><?= _('hour') ?></option>
|
||||||
<option value="86400"><?= _('day') ?></option>
|
<option value="86400"<?= ($_POST['ttl-multiplier'] ?? NULL) === '86400' ? ' selected=""' : '' ?>><?= _('day') ?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="action"><?= _('Action') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-action.inc.php'; ?>
|
||||||
<select name="action" id="action">
|
|
||||||
<option value="add"><?= _('Add') ?></option>
|
|
||||||
<option value="delete"><?= _('Delete') ?></option>
|
|
||||||
</select>
|
|
||||||
<br>
|
<br>
|
||||||
<label for="zone"><?= _('Domain') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||||
<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>
|
|
||||||
<br>
|
<br>
|
||||||
<label for="keytag"><?= _('Key tag') ?></label>
|
<label for="keytag"><?= _('Key tag') ?></label>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="action"><?= _('Action') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-action.inc.php'; ?>
|
||||||
<select name="action" id="action">
|
|
||||||
<option value="add"><?= _('Add') ?></option>
|
|
||||||
<option value="delete"><?= _('Delete') ?></option>
|
|
||||||
</select>
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?= _('Domain') ?></legend>
|
<legend><?= _('Domain') ?></legend>
|
||||||
<div>
|
<div>
|
||||||
|
@ -12,15 +8,7 @@
|
||||||
<input required="" id="subdomain" placeholder="ns1" name="subdomain" type="text">
|
<input required="" id="subdomain" placeholder="ns1" name="subdomain" type="text">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="suffix"><?= _('Domain') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<label for="ip"><?= _('IP address') ?></label><br>
|
<label for="ip"><?= _('IP address') ?></label><br>
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="action"><?= _('Action') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-action.inc.php'; ?>
|
||||||
<select name="action" id="action">
|
|
||||||
<option value="add"><?= _('Add') ?></option>
|
|
||||||
<option value="delete"><?= _('Delete') ?></option>
|
|
||||||
</select>
|
|
||||||
<br>
|
<br>
|
||||||
<label for="domain"><?= _('Domain') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||||
<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>
|
|
||||||
<br>
|
<br>
|
||||||
<label for="ns"><?= _('Name server') ?></label>
|
<label for="ns"><?= _('Name server') ?></label>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="domain"><?= _('Domain') ?></label>
|
<?php require ROOT_PATH . '/pg-view/reg/select-domain.inc.php'; ?>
|
||||||
<select required="" name="domain" id="domain">
|
|
||||||
<option value="" disabled="" selected="">-</option>
|
|
||||||
<?php
|
|
||||||
foreach (regListUserDomains() as $domain)
|
|
||||||
echo ' <option value="' . $domain . '">' . $domain . '</option>' . LF;
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" value="<?= _('Display') ?>">
|
<input type="submit" value="<?= _('Display') ?>">
|
||||||
</form>
|
</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