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,46 @@
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
+    $profilePicture = $_POST['profile_picture_c'];
23
+
24
+    // Get the id of the user for which we want to insert the contact data
25
+    $query1 = $mysqli->prepare("SELECT id, username FROM app_users WHERE BINARY username = ?");
26
+    $query1->bind_param("s", $username);
27
+    $query1->execute();
28
+    $queryres = $query1->get_result()->fetch_assoc();
29
+    $userID = $queryres['id'];
30
+
31
+    $dateModified = date("Y-m-d H:i:s");
32
+
33
+    // Update the contact profile picture
34
+    $query2 = $mysqli->prepare("UPDATE contacts SET profile_picture_c = ?, date_modified = ? WHERE user_id = ? AND contact_name = ?");
35
+    $query2->bind_param("ssis", $profilePicture, $dateModified, $userID, $contactName);
36
+
37
+    if ($query2->execute()) { $messagetosend = 'success'; } else { $messagetosend = 'failure'; }
38
+
39
+    $response = array('result' => $messagetosend);
40
+    echo json_encode($response);
41
+
42
+} else {
43
+    header("Location: ../login.php");
44
+}
45
+
46
+?>