| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,71 @@ |
| 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['crsipusername']) && $_POST['crsipusername'] != '' && isset($_POST['encextenpass']) && $_POST['encextenpass'] != '' && |
|
| 15 |
+ isset($_POST['crvconfextension']) && $_POST['crvconfextension'] != '') {
|
|
| 16 |
+ |
|
| 17 |
+ define('ACCESSCONST', TRUE);
|
|
| 18 |
+ |
|
| 19 |
+ require('db-connect.php');
|
|
| 20 |
+ |
|
| 21 |
+ $crsipusername = $_POST['crsipusername']; |
|
| 22 |
+ $extenPassEnc = $_POST['encextenpass']; |
|
| 23 |
+ $conferenceExt = $_POST['crvconfextension']; |
|
| 24 |
+ |
|
| 25 |
+ // 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 |
|
| 26 |
+ $query = $mysqli->prepare("SELECT exten_for_external, exten_for_ext_pass, conf_extension FROM external_users WHERE exten_for_external = ? AND exten_for_ext_pass = ? AND conf_extension = ?");
|
|
| 27 |
+ $query->bind_param("sss", $crsipusername, $extenPassEnc, $conferenceExt);
|
|
| 28 |
+ $query->execute(); |
|
| 29 |
+ $extqueryres = $query->get_result()->fetch_array(); |
|
| 30 |
+ |
|
| 31 |
+ if (!$extqueryres) {
|
|
| 32 |
+ |
|
| 33 |
+ http_response_code(400); |
|
| 34 |
+ exit(); |
|
| 35 |
+ |
|
| 36 |
+ } else {
|
|
| 37 |
+ |
|
| 38 |
+ // Check if the current user has been banned from accessing this conference |
|
| 39 |
+ $queryselck = $mysqli->prepare("SELECT banned_sipusername, conf_extension, banned_until FROM banned_users WHERE banned_sipusername = ? AND conf_extension = ?");
|
|
| 40 |
+ $queryselck->bind_param("ss", $crsipusername, $conferenceExt);
|
|
| 41 |
+ $queryselck->execute(); |
|
| 42 |
+ $userdatafromdbck = $queryselck->get_result()->fetch_assoc(); |
|
| 43 |
+ |
|
| 44 |
+ if ($userdatafromdbck) {
|
|
| 45 |
+ |
|
| 46 |
+ $currentDate = new DateTime(date("Y-m-d H:i:s"));
|
|
| 47 |
+ $banDate = new DateTime($userdatafromdbck['banned_until']); |
|
| 48 |
+ |
|
| 49 |
+ if ($currentDate <= $banDate) {
|
|
| 50 |
+ $banmessage = 'failure'; |
|
| 51 |
+ } else {
|
|
| 52 |
+ $banmessage = 'success'; |
|
| 53 |
+ |
|
| 54 |
+ // Remove the database record, since the ban time has expired |
|
| 55 |
+ $querydel = $mysqli->prepare("DELETE FROM banned_users WHERE banned_sipusername = ? AND conf_extension = ?");
|
|
| 56 |
+ $querydel->bind_param("ss", $crsipusername, $conferenceExt);
|
|
| 57 |
+ $querydel->execute(); |
|
| 58 |
+ } |
|
| 59 |
+ |
|
| 60 |
+ } else { $banmessage = 'success'; }
|
|
| 61 |
+ } |
|
| 62 |
+ |
|
| 63 |
+ $response = array('notbanned' => $banmessage);
|
|
| 64 |
+ |
|
| 65 |
+ echo json_encode($response); |
|
| 66 |
+ |
|
| 67 |
+} else {
|
|
| 68 |
+ header("Location: ../login.php");
|
|
| 69 |
+} |
|
| 70 |
+ |
|
| 71 |
+?> |