Browse code

Created repository.

DoubleBastionAdmin authored on 26/01/2022 20:32:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
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 user for which we want to get the external user data
21
+    $query1 = $mysqli->query("SELECT id, userrole, username, enabled FROM app_users WHERE userrole = 'superadmin' AND BINARY username = '$username' AND enabled = 1");
22
+    $queryres = $query1->fetch_array();
23
+    $userID = $queryres[0];
24
+
25
+    $extdatafromdb = [];
26
+
27
+    if ($userID != '') {
28
+
29
+	    // Get the data for the current user from the 'external_users' table
30
+	    $querysel = $mysqli->query("SELECT id, userid, exten_for_external, exten_for_ext_pass, conf_access_link FROM external_users WHERE userid = '$userID'");
31
+
32
+            while ($extUserDataRow = $querysel->fetch_row()) {
33
+
34
+                    $extenforexternal = $extUserDataRow[2];
35
+
36
+		    if ($extUserDataRow[3] != '' && $extUserDataRow[3] != null && $extUserDataRow[3] != 'undefined') {
37
+			     $sippassword = "%20%20%20%20%20%20%20";
38
+		    } else { $sippassword = ''; }
39
+
40
+                    $confaccesslink = $extUserDataRow[4];
41
+
42
+                   $extdatafromdb[] = ['exten_for_external' => $extenforexternal, 'exten_for_ext_pass' => $sippassword, 'conf_access_link' => $confaccesslink];                   
43
+            }
44
+    }
45
+    echo json_encode($extdatafromdb);
46
+
47
+} else {
48
+    header("Location: roundpin-login.php");
49
+}
50
+
51
+?>
0 52
\ No newline at end of file