servnest/pg-act/ht/del.php
2023-07-17 21:15:18 +02:00

11 lines
518 B
PHP

<?php declare(strict_types=1);
if (preg_match('/^(?<type>subpath|subdomain|onion|dns):(?<address>[a-z0-9._-]{1,256})$/D', $_POST['site'], $site) !== 1)
output(403, 'Malformed value for <code>site</code>.');
if (isset(query('select', 'sites', ['username' => $_SESSION['id'], 'address' => $site['address'], 'type' => $site['type']], 'address')[0]) !== true)
output(403, 'Unavailable value for <code>site</code>.');
htDeleteSite($site['address'], $site['type'], $_SESSION['id']);
output(200, _('Access removed.'));