68 lines
1.5 KiB
PHP
68 lines
1.5 KiB
PHP
<?php require "../../common/html.php"; ?>
|
|
|
|
<form method="post">
|
|
|
|
<?php require "../../form.ns.php"; ?>
|
|
|
|
<br>
|
|
|
|
<label for="algo">Algorithme</label>
|
|
<br>
|
|
<select required="" name="algo" id="algo">
|
|
<option value="1">1 (RSA)</option>
|
|
<option value="2" disabled="">2 (DSA)</option>
|
|
<option value="3">3 (ECDSA)</option>
|
|
<option value="4" selected="">4 (ED25519)</option>
|
|
</select>
|
|
|
|
<br>
|
|
|
|
<label for="type">Type de hash</label>
|
|
<br>
|
|
<select required="" name="type" id="type">
|
|
<option value="1" disabled="">1 (SHA-1)</option>
|
|
<option value="2" selected="">2 (SHA-256)</option>
|
|
</select>
|
|
<br>
|
|
|
|
<label for="fp">Empreinte</label>
|
|
<br>
|
|
<input required="" id="fp" size="65" minlenght="64" maxlength="64" placeholder="26e6bbb4796c4fb78632e737d31a8acaba43c3a92d9c047031f04e9b70826e1d" name="fp" type="text">
|
|
|
|
<br>
|
|
<input value="Valider" type="submit">
|
|
</form>
|
|
|
|
<?php
|
|
|
|
if (nsCommonRequirements()
|
|
AND isset($_POST['algo'])
|
|
AND isset($_POST['fp'])
|
|
) {
|
|
|
|
$values = nsParseCommonRequirements();
|
|
|
|
if (!($_POST['algo'] === "1" OR $_POST['algo'] === "3" OR $_POST['algo'] === "4"))
|
|
userError("Wrong value for <code>algo</code>.");
|
|
|
|
if (!($_POST['type'] === "2"))
|
|
userError("Wrong value for <code>type</code>.");
|
|
|
|
if (!(preg_match("/^[a-z0-9]{64}$/", $_POST['fp'])))
|
|
userError("Wrong value for <code>fp</code>.");
|
|
|
|
knotcExec($_POST['zone'], array(
|
|
$values['domain'],
|
|
$values['ttl'],
|
|
"SSHFP",
|
|
$_POST['algo'],
|
|
$_POST['type'],
|
|
$_POST['fp']
|
|
));
|
|
|
|
echo "Enregistrement ajouté";
|
|
}
|
|
|
|
?>
|
|
|
|
<?php closeHTML(); ?>
|