servnest/public/ns/txt.php

32 lines
978 B
PHP
Raw Normal View History

2022-04-22 23:57:43 +00:00
<?php require "../../common/top.php"; ?>
2021-02-24 17:39:42 +00:00
<form method="post">
2022-04-22 23:57:43 +00:00
<?php require "../../form.ns.php"; ?>
2022-04-18 14:05:00 +00:00
<br>
<label for="txt">Texte</label>
<br>
<input id="txt" minlenght="5" maxlength="8192" pattern="^[a-zA-Z0-9 =:!%$+/\()[\]_-]{5,8192}$" placeholder="Du texte..." name="txt" type="text">
<br>
<input value="Valider" type="submit">
2021-02-24 17:39:42 +00:00
</form>
<?php
2021-05-16 14:55:39 +00:00
if (nsCommonRequirements()
2022-04-18 14:05:00 +00:00
AND isset($_POST['txt'])
) {
2021-02-24 17:39:42 +00:00
2022-04-18 14:05:00 +00:00
$values = nsParseCommonRequirements();
2021-02-24 17:39:42 +00:00
2022-04-18 14:05:00 +00:00
if (!(preg_match("/^[a-zA-Z0-9 =:!%$+\/\()[\]_-]{5,8192}$/", $_POST['txt'])))
userError("Wrong value for <code>txt</code>.");
2021-02-24 17:39:42 +00: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 TXT \"' . $_POST['txt'] . '\"');
exec(CONF['ns']['knotc_path'] . " zone-commit " . $_POST['zone']);
2022-04-18 14:05:00 +00:00
echo "Enregistrement ajouté";
2021-02-24 17:39:42 +00:00
}
?>
2022-04-22 23:57:43 +00:00
<?php require "../../common/bottom.php"; ?>