1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,44 @@ |
1 |
+<?php |
|
2 |
+/** |
|
3 |
+ * Copyright (C) 2021 Double Bastion LLC |
|
4 |
+ * |
|
5 |
+ * This file is part of Roundpin, which is licensed under the |
|
6 |
+ * GNU Affero General Public License Version 3.0. The license terms |
|
7 |
+ * are detailed in the "LICENSE.txt" file located in the root directory. |
|
8 |
+ */ |
|
9 |
+ |
|
10 |
+session_start(); |
|
11 |
+ |
|
12 |
+if (isset($_POST['s_ajax_call']) && ($_POST['s_ajax_call'] == $_SESSION['validate_s_access'])) { |
|
13 |
+ |
|
14 |
+ define('ACCESSCONST', TRUE); |
|
15 |
+ |
|
16 |
+ require('db-connect.php'); |
|
17 |
+ |
|
18 |
+ $username = $_POST['username']; |
|
19 |
+ |
|
20 |
+ // Get the id of the superadmin for which we want to remove the data |
|
21 |
+ $selectid = $mysqli->query("SELECT id, userrole, username, enabled FROM app_users WHERE userrole = 'superadmin' AND BINARY username = '$username' AND enabled = 1"); |
|
22 |
+ $queryres = $selectid->fetch_array(); |
|
23 |
+ $userID = $queryres[0]; |
|
24 |
+ |
|
25 |
+ // Remove the row(s) corresponding to the specified superadmin from the 'external_users' table |
|
26 |
+ $removequery = $mysqli->prepare("DELETE FROM external_users WHERE userid=?"); |
|
27 |
+ $removequery->bind_param("i", $userID); |
|
28 |
+ |
|
29 |
+ if ($removequery->execute()) { $messagetosend = 'success'; } else { $messagetosend = 'failure'; } |
|
30 |
+ $removequery->close(); |
|
31 |
+ |
|
32 |
+ // Remove the password files directory |
|
33 |
+ if (is_dir("restr/".$username."/externalext")) { |
|
34 |
+ $removedir = exec("rm -rf restr/".$username."/externalext"); |
|
35 |
+ } |
|
36 |
+ |
|
37 |
+ $response = array('result' => $messagetosend); |
|
38 |
+ echo json_encode($response); |
|
39 |
+ |
|
40 |
+} else { |
|
41 |
+ header("Location: roundpin-login.php"); |
|
42 |
+} |
|
43 |
+ |
|
44 |
+?> |