tlsa.php 733 B

1234567891011121314151617181920212223242526272829
  1. <?php declare(strict_types=1);
  2. $values = nsParseCommonRequirements();
  3. if (!($_POST['use'] >= 0 AND $_POST['use'] <= 3))
  4. output(403, 'Wrong value for <code>use</code>.');
  5. if (!($_POST['selector'] === '0' OR $_POST['selector'] === '1'))
  6. output(403, 'Wrong value for <code>selector</code>.');
  7. if (!($_POST['type'] >= 0 AND $_POST['type'] <= 2))
  8. output(403, 'Wrong value for <code>type</code>.');
  9. if (!(preg_match('/^[a-zA-Z0-9.-]{1,1024}$/D', $_POST['content'])))
  10. output(403, 'Wrong value for <code>content</code>.');
  11. rateLimit();
  12. knotcZoneExec($_POST['zone'], [
  13. $values['domain'],
  14. $values['ttl'],
  15. 'TLSA',
  16. $_POST['use'],
  17. $_POST['selector'],
  18. $_POST['type'],
  19. $_POST['content']
  20. ]);
  21. output(200, _('Modification done.'));