servnest/pg-act/ht/del.php

12 lines
520 B
PHP
Raw Permalink Normal View History

2023-07-17 19:15:18 +00:00
<?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.'));