1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,42 @@ |
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 current user from the 'app_users' table |
|
21 |
+ $queryid = $mysqli->query("SELECT id, username, enabled FROM app_users WHERE BINARY username = '$username' AND enabled = 1"); |
|
22 |
+ $queryres = $queryid->fetch_array(); |
|
23 |
+ $userID = $queryres[0]; |
|
24 |
+ |
|
25 |
+ // Get the contacts for the current user |
|
26 |
+ $querycont = $mysqli->query("SELECT id, user_id, contact_name, contact_desc, extension_number, contact_mobile, contact_num1, contact_num2, contact_email, |
|
27 |
+ profile_picture_c FROM contacts WHERE user_id = '$userID'"); |
|
28 |
+ $contactsarr = []; |
|
29 |
+ while ($querycontres = $querycont->fetch_row()) { |
|
30 |
+ $contactsarr[] = ['contact_name' => $querycontres[2], 'contact_desc' => $querycontres[3], 'extension_number' => $querycontres[4], 'contact_mobile' => $querycontres[5], |
|
31 |
+ 'contact_num1' => $querycontres[6], 'contact_num2' => $querycontres[7], 'contact_email' => $querycontres[8], 'profile_picture_c' => $querycontres[9]]; |
|
32 |
+ } |
|
33 |
+ |
|
34 |
+ $contactsfromdb = ['contactsinfo' => $contactsarr]; |
|
35 |
+ |
|
36 |
+ echo json_encode($contactsfromdb); |
|
37 |
+ |
|
38 |
+} else { |
|
39 |
+ header("Location: roundpin-login.php"); |
|
40 |
+} |
|
41 |
+ |
|
42 |
+?> |