servnest/public/ns/srv.php

73 lines
1.6 KiB
PHP
Raw Normal View History

<?php require "../../common/html.php"; ?>
2021-05-16 16:55:39 +02:00
<form method="post">
<?php require "../../form.ns.php"; ?>
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<br>
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<label for="priority">Priorité</label>
<br>
<input id="priority" min="0" max="65535" value="0" placeholder="0" name="priority" type="number">
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<br>
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<label for="weight">Poids</label>
<br>
<input id="weight" min="0" max="65535" value="0" placeholder="0" name="weight" type="number">
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<br>
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<label for="port">Port</label>
<br>
<input id="port" min="0" max="65535" placeholder="32768" name="port" type="number">
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<br>
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<label for="target">Cible</label>
<br>
<input id="target" minlenght="1" maxlength="128" placeholder="service.<?= CONF['common']['domain_example'] ?>." name="target" type="text">
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
<br>
<input value="Valider" type="submit">
2021-05-16 16:55:39 +02:00
</form>
<?php
if (nsCommonRequirements()
2022-04-18 16:05:00 +02:00
AND isset($_POST['priority'])
AND isset($_POST['weight'])
AND isset($_POST['port'])
AND isset($_POST['target'])
) {
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
$values = nsParseCommonRequirements();
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 65535))
userError("Wrong value for <code>priority</code>.");
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535))
userError("Wrong value for <code>weight</code>.");
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535))
userError("Wrong value for <code>port</code>.");
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
checkAbsoluteDomainFormat($_POST['target']);
2021-05-16 16:55:39 +02:00
2022-05-25 01:16:41 +02:00
knotcExec($_POST['zone'], array(
$values['domain'],
$values['ttl'],
"SRV",
$_POST['priority'],
$_POST['weight'],
$_POST['port'],
$_POST['target']
));
2022-04-18 16:05:00 +02:00
echo "Enregistrement ajouté";
2021-05-16 16:55:39 +02:00
}
?>
<?php closeHTML(); ?>