servnest/public/ns/srv.php

63 lines
1.4 KiB
PHP

<?php require "../../common/html.php"; ?>
<form method="post">
<?php require "../../form.ns.php"; ?>
<br>
<label for="priority">Priorité</label>
<br>
<input id="priority" min="0" max="65535" value="0" placeholder="0" name="priority" type="number">
<br>
<label for="weight">Poids</label>
<br>
<input id="weight" min="0" max="65535" value="0" placeholder="0" name="weight" type="number">
<br>
<label for="port">Port</label>
<br>
<input id="port" min="0" max="65535" placeholder="32768" name="port" type="number">
<br>
<label for="target">Cible</label>
<br>
<input id="target" minlenght="1" maxlength="128" placeholder="service.<?= PLACEHOLDER_DOMAIN ?>." name="target" type="text">
<br>
<input value="Valider" type="submit">
</form>
<?php
switchToFormProcess();
$values = nsParseCommonRequirements();
if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 65535))
userError("Wrong value for <code>priority</code>.");
if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535))
userError("Wrong value for <code>weight</code>.");
if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535))
userError("Wrong value for <code>port</code>.");
$_POST['target'] = formatAbsoluteDomain($_POST['target']);
knotcZoneExec($_POST['zone'], array(
$values['domain'],
$values['ttl'],
"SRV",
$_POST['priority'],
$_POST['weight'],
$_POST['port'],
$_POST['target']
));
success("Enregistrement ajouté");