2023-07-17 19:15:18 +00:00
|
|
|
<?php declare(strict_types=1);
|
2022-12-22 00:44:57 +00:00
|
|
|
|
|
|
|
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>.');
|
|
|
|
|
2023-10-07 22:50:48 +00:00
|
|
|
if (isset(query('select', 'sites', ['username' => $_SESSION['id'], 'address' => $site['address'], 'type' => $site['type']], ['address'])[0]) !== true)
|
2022-12-22 00:44:57 +00:00
|
|
|
output(403, 'Unavailable value for <code>site</code>.');
|
|
|
|
|
2023-06-08 15:36:44 +00:00
|
|
|
htDeleteSite($site['address'], $site['type'], $_SESSION['id']);
|
2022-12-22 00:44:57 +00:00
|
|
|
|
2023-01-21 00:27:52 +00:00
|
|
|
output(200, _('Access removed.'));
|