Fix delete site

This commit is contained in:
Josh North 2021-05-07 16:45:17 -04:00
parent 30c04e6f73
commit b19f2f8ac4
2 changed files with 13 additions and 3 deletions

View File

@ -90,6 +90,16 @@ class SiteInfo {
if(empty($rows)) {
return "0";} else { return "1";};
}
public function delSiteAdminPerms ($users_id, $sites_id) {
$query = "
DELETE
FROM " . Registry::DB_PRFX . "users_sites
WHERE " . Registry::DB_PRFX . "users_sites.users_id=\"$users_id\" AND " . Registry::DB_PRFX . "users_sites.sites_id=\"$sites_id\"";
$database = new \App\LobbySIO\Database\Connect();
$rows = $database->getQuery($query);
if(empty($rows)) {
return "0";} else { return "1";};
}
public function setSitePerms ($sites_id, $users_id) {
$query = "
INSERT

View File

@ -411,9 +411,9 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
if (!empty($_POST['delsite'])) {
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
$deleteid = (int) $_POST['deleteid'];
$SiteInfo->delSitePerms ('0');
$SiteInfo->delSitePerms ('1');
$SiteInfo->delSitePerms ('2');
$SiteInfo->delSiteAdminPerms ('0', $deleteid);
$SiteInfo->delSiteAdminPerms ('1', $deleteid);
$SiteInfo->delSiteAdminPerms ('2', $deleteid);
echo $SiteInfo->deleteSite($deleteid);
echo "site deleted!";
header('Location: ' . $_SERVER['PHP_SELF']);