65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<?php include "../top.inc.php"; ?>
|
|
|
|
<form method="post">
|
|
|
|
<?php require "../inc/form/form.ns.inc.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.<?= DOMAIN_EXAMPLE ?>." name="target" type="text">
|
|
|
|
<br>
|
|
<input value="Valider" type="submit">
|
|
</form>
|
|
|
|
<?php
|
|
|
|
if (nsCommonRequirements()
|
|
AND isset($_POST['priority'])
|
|
AND isset($_POST['weight'])
|
|
AND isset($_POST['port'])
|
|
AND isset($_POST['target'])
|
|
) {
|
|
|
|
$values = nsParseCommonRequirements();
|
|
|
|
if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 65535))
|
|
exit("ERROR: Wrong value for priority");
|
|
|
|
if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535))
|
|
exit("ERROR: Wrong value for weight");
|
|
|
|
if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535))
|
|
exit("ERROR: Wrong value for port");
|
|
|
|
checkAbsoluteDomainFormat($_POST['target']);
|
|
|
|
exec(KNOTC_PATH . " zone-begin " . $_POST['zone']);
|
|
exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN SRV " . $_POST['priority'] . " " . $_POST['weight'] . " " . $_POST['port'] . " " . $_POST['target']);
|
|
exec(KNOTC_PATH . " zone-commit " . $_POST['zone']);
|
|
echo "Enregistrement ajouté";
|
|
}
|
|
|
|
?>
|
|
|
|
<?php include "../bottom.inc.php"; ?>
|