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,59 @@
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['vconfextension']) && $_POST['vconfextension'] != '' && isset($_POST['encextenpass']) && $_POST['encextenpass'] != '' && isset($_POST['conferenceext']) &&
15
+    $_POST['conferenceext'] != '' && isset($_POST['evconfdisplayname']) && isset($_POST['showusernames']) && $_POST['showusernames'] != '') {
16
+
17
+    define('ACCESSCONST', TRUE);
18
+
19
+    require('db-connect.php');
20
+
21
+    $vconfExtension = $_POST['vconfextension'];
22
+    $extenPassEnc = $_POST['encextenpass'];
23
+    $conferenceExt = $_POST['conferenceext'];
24
+
25
+    $vconfDisplayName = $_POST['evconfdisplayname'];
26
+    $showUsernames = $_POST['showusernames'];
27
+
28
+    if ($vconfDisplayName == '') { $displayVConfUser = '0'; } else { $displayVConfUser = '1'; }
29
+
30
+    // Check if the received external user extension, the corresponding encrypted password and the extension of the conference, match the data in the 'external_users' table
31
+    $query = $mysqli->prepare("SELECT id, exten_for_external, exten_for_ext_pass, conf_extension FROM external_users WHERE exten_for_external = ? AND exten_for_ext_pass = ? AND conf_extension = ?");
32
+    $query->bind_param("sss", $vconfExtension, $extenPassEnc, $conferenceExt);
33
+    $query->execute();
34
+    $extqueryres = $query->get_result()->fetch_array();
35
+
36
+    if (!$extqueryres) {
37
+
38
+        http_response_code(400);
39
+        exit();
40
+
41
+    } else {
42
+
43
+        $date = date("Y-m-d H:i:s");
44
+	$updatequery = $mysqli->prepare("UPDATE external_users SET profile_name = ?, show_vconf_usernames = ?, display_vconf_user = ?, date_modified = ? WHERE exten_for_external = ? AND 
45
+                                         exten_for_ext_pass = ? AND conf_extension = ?");
46
+	$updatequery->bind_param("siissss", $vconfDisplayName, $showUsernames, $displayVConfUser, $date, $vconfExtension, $extenPassEnc, $conferenceExt);
47
+
48
+	if ($updatequery->execute()) { $messagetosend = 'The data has been successfully saved to the database !'; } else { $messagetosend = 'Error while saving the data!'; }
49
+    }
50
+
51
+    $response = array('result' => $messagetosend);
52
+
53
+    echo json_encode($response);
54
+
55
+} else {
56
+    header("Location: ../login.php");
57
+}
58
+
59
+?>