| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,61 @@ |
| 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 |
+ // header('Set-Cookie: PHPSESSID= ' . session_id() . '; SameSite=strict; Secure=true; HttpOnly=true;');
|
|
| 13 |
+ |
|
| 14 |
+if (isset($_POST['s_ajax_call']) && ($_POST['s_ajax_call'] == $_SESSION['validate_s_access'])) {
|
|
| 15 |
+ |
|
| 16 |
+ define('ACCESSCONST', TRUE);
|
|
| 17 |
+ |
|
| 18 |
+ require('db-connect.php');
|
|
| 19 |
+ |
|
| 20 |
+ $username = $_POST['username']; |
|
| 21 |
+ |
|
| 22 |
+ // Get the id of the user for which we want to get the external user data |
|
| 23 |
+ $enabled = 1; |
|
| 24 |
+ $query1 = $mysqli->prepare("SELECT id, userrole, username, enabled FROM app_users WHERE (userrole = 'admin' OR userrole = 'superadmin') AND BINARY username = ? AND enabled = ?");
|
|
| 25 |
+ $query1->bind_param("si", $username, $enabled);
|
|
| 26 |
+ $query1->execute(); |
|
| 27 |
+ $queryres = $query1->get_result()->fetch_assoc(); |
|
| 28 |
+ $userID = $queryres['id']; |
|
| 29 |
+ |
|
| 30 |
+ $extdatafromdb = []; |
|
| 31 |
+ |
|
| 32 |
+ if ($userID != '') {
|
|
| 33 |
+ |
|
| 34 |
+ // Get the data for the current user from the 'external_users' table |
|
| 35 |
+ $querysel = $mysqli->prepare("SELECT id, userid, profile_name, exten_for_external, exten_for_ext_pass, conf_extension, conf_tag, conf_access_link FROM external_users WHERE userid = ?");
|
|
| 36 |
+ $querysel->bind_param("s", $userID);
|
|
| 37 |
+ $querysel->execute(); |
|
| 38 |
+ $queryselres = $querysel->get_result(); |
|
| 39 |
+ |
|
| 40 |
+ while ($extUserDataRow = $queryselres->fetch_assoc()) {
|
|
| 41 |
+ |
|
| 42 |
+ $extenforexternal = $extUserDataRow['exten_for_external']; |
|
| 43 |
+ |
|
| 44 |
+ if ($extUserDataRow['exten_for_ext_pass'] != '' && $extUserDataRow['exten_for_ext_pass'] != null && $extUserDataRow['exten_for_ext_pass'] != 'undefined') {
|
|
| 45 |
+ $sippassword = "%20%20%20%20%20%20%20"; |
|
| 46 |
+ } else { $sippassword = ''; }
|
|
| 47 |
+ |
|
| 48 |
+ $confExtension = $extUserDataRow['conf_extension']; |
|
| 49 |
+ $confTag = $extUserDataRow['conf_tag']; |
|
| 50 |
+ $confaccesslink = $extUserDataRow['conf_access_link']; |
|
| 51 |
+ |
|
| 52 |
+ $extdatafromdb[] = ['exten_for_external' => $extenforexternal, 'exten_for_ext_pass' => $sippassword, 'conf_extension' => $confExtension, 'conf_tag' => $confTag, 'conf_access_link' => $confaccesslink]; |
|
| 53 |
+ } |
|
| 54 |
+ } |
|
| 55 |
+ echo json_encode($extdatafromdb); |
|
| 56 |
+ |
|
| 57 |
+} else {
|
|
| 58 |
+ header("Location: ../login.php");
|
|
| 59 |
+} |
|
| 60 |
+ |
|
| 61 |
+?> |