Browse code

Created repository.

DoubleBastionAdmin authored on 29/11/2024 03:10:08
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,69 @@
1
+<?php
2
+
3
+/**
4
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com>
5
+ *
6
+ * @author Double Bastion LLC
7
+ *
8
+ * @license GNU AGPL version 3 or any later version
9
+ *
10
+ * This program is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
12
+ * License as published by the Free Software Foundation; either
13
+ * version 3 of the License, or any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
19
+ *
20
+ * You should have received a copy of the GNU Affero General Public
21
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
+ *
23
+ */
24
+
25
+session_start();
26
+
27
+define('ACCESSCONST', TRUE);
28
+
29
+
30
+if (($_SESSION['loggedtorspanel'] == true) && ($_SESSION['userrole'] == 'superadmin')) {
31
+
32
+     require('db-connect.php');
33
+
34
+     // Delete button data from the database
35
+     if (isset($_POST['databaseId'])) {
36
+
37
+         $databaseId = $_POST['databaseId'];
38
+
39
+         try {
40
+             $query2 = $mysqli->prepare("DELETE FROM buttons WHERE id=?");
41
+             $query2->bind_param("i", $databaseId);
42
+             $query2->execute();
43
+             $query2->close();
44
+
45
+             $messageondelete = "The button has been removed successfully !";
46
+
47
+         } catch(mysqli_sql_exception $e) {
48
+                $messageondelete = "An error occurred when removing the button !";
49
+           }
50
+
51
+     }
52
+
53
+   $response = array(
54
+        'messageondelete' => $messageondelete
55
+   );
56
+
57
+   echo json_encode($response);
58
+
59
+
60
+} elseif (empty($_SESSION['loggedtorspanel'])) {
61
+
62
+      header("Location: panel-login.php");
63
+
64
+} elseif (($_SESSION['loggedtorspanel'] == true) && ($_SESSION['userrole'] != 'superadmin'))  {
65
+
66
+      header("Location: index.php");
67
+}
68
+
69
+?>