servnest/public/ns/mx.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2022-04-23 01:57:43 +02:00
<?php require "../../common/top.php"; ?>
2021-05-16 16:55:39 +02:00
<form method="post">
2022-04-23 01:57:43 +02:00
<?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="host">Hôte</label>
<br>
<input id="host" placeholder="mail.<?= CONF['common']['domain_example'] ?>." name="host" 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['host'])
) {
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'] <= 255))
userError("Wrong value for <code>priority</code>.");
2021-05-16 16:55:39 +02:00
2022-04-18 16:05:00 +02:00
checkAbsoluteDomainFormat($_POST['host']);
2021-05-16 16:55:39 +02:00
exec(CONF['ns']['knotc_path'] . " zone-begin " . $_POST['zone']);
exec(CONF['ns']['knotc_path'] . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN MX " . $_POST['priority'] . " " . $_POST['host']);
exec(CONF['ns']['knotc_path'] . " zone-commit " . $_POST['zone']);
2022-04-18 16:05:00 +02:00
echo "Enregistrement ajouté";
2021-05-16 16:55:39 +02:00
}
?>
2022-04-23 01:57:43 +02:00
<?php require "../../common/bottom.php"; ?>