servnest/public/reg/glue.php

60 lines
1.5 KiB
PHP

<?php require "../../common/html.php"; ?>
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<fieldset>
<legend>Domaine</legend>
<div class="elForm">
<label for="subdomain">Sous-domaine</label>
<br>
<input required="" id="subdomain" placeholder="ns1" name="subdomain" type="text">
</div>
<div class="elForm">
<label for="suffix">Domaine</label>
<br>
<select required="" name="suffix" id="suffix">
<option value="" disabled="" selected="">---</option>
<?php
if (isset($_SESSION['username']))
foreach(regListUserDomains($_SESSION['username']) as $suffix)
echo " <option value='" . $suffix . "'>." . $suffix . "</option>";
?>
</select>
</div>
</fieldset>
<label for="ip">IP</label><br>
<input required="" pattern="^[a-f0-9:.]+$" id="ip" name="ip" minlength="7" maxlength="39" size="40" type="text" placeholder="<?= PLACEHOLDER_IPV4 ?> ou <?= PLACEHOLDER_IPV6 ?>">
<br>
<input value="Valider" type="submit">
</form>
<p>
<?= linkToDocs('glue-record', 'Les glue records'); ?>
</p>
<?php
switchToFormProcess();
regCheckDomainPossession($_POST['suffix']);
$domain = formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']);
$record = checkIpFormat($_POST['ip']);
knotcZoneExec(CONF['reg']['registry'], array(
$domain,
CONF['reg']['ttl'],
$record,
$_POST['ip']
));
success("Glue record ajouté");