52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php include "../top.inc.php"; ?>
|
|
|
|
<form method="post">
|
|
|
|
<?php require "../inc/form/form.ns.inc.php"; ?>
|
|
|
|
<br>
|
|
<label for="flag">Flag</label>
|
|
<br>
|
|
<input id="flag" min="0" max="127" placeholder="0" name="flag" type="number">
|
|
<br>
|
|
<label for="tag">Tag</label>
|
|
<br>
|
|
<input id="tag" minlenght="1" maxlength="128" pattern="^[a-z]{1,128}$" placeholder="issue" name="tag" type="text">
|
|
<br>
|
|
<label for="value">Valeur</label>
|
|
<br>
|
|
<input id="value" minlenght="3" maxlength="1024" pattern="^[a-z0-9.-]{3,1024}$" placeholder="letsencrypt.org" name="value" type="text">
|
|
<br>
|
|
<input value="Valider" type="submit">
|
|
</form>
|
|
|
|
<?php
|
|
|
|
if (nsCommonRequirements()
|
|
AND isset($_POST['flag'])
|
|
AND isset($_POST['tag'])
|
|
AND isset($_POST['value'])
|
|
) {
|
|
|
|
$values = nsParseCommonRequirements();
|
|
|
|
if (!($_POST['flag'] >= 0 AND $_POST['flag'] <= 255))
|
|
exit("ERROR: Wrong value for flag");
|
|
|
|
if (!(preg_match("/^[a-z]{1,127}$/", $_POST['tag'])))
|
|
exit("ERROR: Wrong value for tag");
|
|
|
|
if (!(preg_match("/^[a-z0-9.-]{1,255}$/", $_POST['value'])))
|
|
exit("ERROR: Wrong value for value");
|
|
|
|
exec(KNOTC_PATH . " zone-begin " . $_POST['zone']);
|
|
exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN CAA " . $_POST['flag'] . " " . $_POST['tag'] . " " . $_POST['value']);
|
|
exec(KNOTC_PATH . " zone-commit " . $_POST['zone']);
|
|
echo "Enregistrement ajouté";
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<?php include "../bottom.inc.php"; ?>
|