Browse code

Changed majority of files.

DoubleBastionAdmin authored on 30/11/2024 06:56:40
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,47 @@
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
+    $contactName = $_POST['contact_name'];
22
+
23
+    // Get the id of the user for which we want to update the contact data
24
+    $query1 = $mysqli->prepare("SELECT id, username FROM app_users WHERE BINARY username = ?");
25
+    $query1->bind_param("s", $username);
26
+    $query1->execute();
27
+    $queryres = $query1->get_result()->fetch_assoc();
28
+    $userID = $queryres['id'];
29
+
30
+    // Get the row id from the 'contacts' table, for the current contact
31
+    $query2 = $mysqli->prepare("SELECT id, user_id, contact_name FROM contacts WHERE user_id = ? AND contact_name = ?");
32
+    $query2->bind_param("is", $userID, $contactName);
33
+    $query2->execute();
34
+    $fetchInfo = $query2->get_result()->fetch_assoc();
35
+    $contactRowId = $fetchInfo['id'];
36
+
37
+    if ($contactRowId != '' && $contactRowId != null && $contactRowId != 'undefined') {
38
+        $CntctDatabaseId = $contactRowId;
39
+        $messagetosend = 'success';
40
+    } else { $CntctDatabaseId = ''; $messagetosend = "An error occurred while getting the contact\'s row id!"; }
41
+
42
+    $response = ['successorfailure' => $messagetosend, 'cntctDatabaseID' => $CntctDatabaseId];
43
+    echo json_encode($response);
44
+
45
+} else { header("Location: ../login.php"); }
46
+
47
+?>