-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteGroup.php
34 lines (29 loc) · 1 KB
/
deleteGroup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require 'database.php';
require 'generalNotificationFuncs.php';
$gid = $_POST["gid"];
if (!empty($gid)) {
$db = new Database();
$stmt = $db->prepare("SELECT name FROM groups WHERE groupID = :gid");
$stmt->bindValue(":gid", $gid, SQLITE3_INTEGER);
$result = $stmt->execute();
$temp = $result->fetchArray();
$name = $temp[0];
$stmt = $db->prepare("SELECT userID from groupUserRel WHERE groupID = :gid");
$stmt->bindValue(":gid", $gid, SQLITE3_INTEGER);
$result = $stmt->execute();
while ($user = $result->fetchArray()) {
$stmt = $db->prepare("INSERT INTO notifications(userID, typeID, custmsg) VALUES(:uid, 6, :gn)");
$stmt->bindValue(":uid", $user[0], SQLITE3_INTEGER);
$stmt->bindValue(":gn", $name, SQLITE3_TEXT);
$stmt->execute();
$liid = $db->lastInsertRowID();
notiLumpGroup($db, $liid, $gid);
}
$stmt = $db->prepare("DELETE FROM groupUserRel WHERE groupID = :gid");
$stmt->bindValue(":gid", $gid, SQLITE3_INTEGER);
$stmt->execute();
exit();
}
?>
<?php include "wrongTurn.php"; ?>