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,77 @@
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['clrextension']) && $_POST['clrextension'] != '') {
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
+    $callerExt = $_POST['clrextension'];
26
+    $callerExtMod = substr($callerExt, 0, -5);
27
+
28
+    // 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
29
+    $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 = ?");
30
+    $query->bind_param("sss", $vconfExtension, $extenPassEnc, $conferenceExt);
31
+    $query->execute();
32
+    $extqueryres = $query->get_result()->fetch_array();
33
+
34
+    if (!$extqueryres) {
35
+
36
+        http_response_code(400);
37
+        exit();
38
+
39
+    } else {
40
+
41
+	    if ($callerExt != null && $callerExt != 'undefined' && $callerExt != '') {
42
+
43
+		$query2 = $mysqli->prepare("SELECT id, wss_server, profile_name, sip_username, display_vconf_user FROM app_users WHERE sip_username = ?");
44
+		$query2->bind_param("s", $callerExtMod);
45
+		$query2->execute();
46
+		$userpref = $query2->get_result()->fetch_assoc();
47
+
48
+		if ($userpref) {
49
+
50
+		    $userDesc = $userpref['profile_name'];
51
+		    $nameDisplay = $userpref['display_vconf_user'];
52
+		    $messagetosend = 'success';
53
+
54
+		} else {
55
+
56
+		    $query3 = $mysqli->prepare("SELECT id, profile_name, exten_for_external, display_vconf_user FROM external_users WHERE exten_for_external = ?");
57
+		    $query3->bind_param("s", $callerExt);
58
+		    $query3->execute();
59
+		    $userdisplay = $query3->get_result()->fetch_assoc();
60
+
61
+		    if ($userdisplay) {
62
+
63
+		        $userDesc = $userdisplay['profile_name'];
64
+			$nameDisplay = $userdisplay['display_vconf_user'];
65
+			$messagetosend = 'success';
66
+
67
+		    } else { $userDesc = null; $nameDisplay = null; $messagetosend = "An error occurred while getting the user data!"; }
68
+		}
69
+	    }
70
+  
71
+    }
72
+
73
+    $response = ['result' => $messagetosend, 'userdescription' => $userDesc, 'namedisplay' => $nameDisplay];
74
+
75
+    echo json_encode($response);
76
+
77
+} else { header("Location: ../login.php"); }