servnest/pg-act/ns/tlsa.php

30 lines
733 B
PHP

<?php declare(strict_types=1);
$values = nsParseCommonRequirements();
if (!($_POST['use'] >= 0 AND $_POST['use'] <= 3))
output(403, 'Wrong value for <code>use</code>.');
if (!($_POST['selector'] === '0' OR $_POST['selector'] === '1'))
output(403, 'Wrong value for <code>selector</code>.');
if (!($_POST['type'] >= 0 AND $_POST['type'] <= 2))
output(403, 'Wrong value for <code>type</code>.');
if (!(preg_match('/^[a-zA-Z0-9.-]{1,1024}$/D', $_POST['content'])))
output(403, 'Wrong value for <code>content</code>.');
rateLimit();
knotcZoneExec($_POST['zone'], [
$values['domain'],
$values['ttl'],
'TLSA',
$_POST['use'],
$_POST['selector'],
$_POST['type'],
$_POST['content']
]);
output(200, _('Modification done.'));