| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,43 @@ |
| 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 |
+ // header('Set-Cookie: PHPSESSID= ' . session_id() . '; SameSite=strict; Secure=true; HttpOnly=true;');
|
|
| 12 |
+ |
|
| 13 |
+if (isset($_POST['s_ajax_call']) && ($_POST['s_ajax_call'] == $_SESSION['validate_s_access']) && isset($_POST['currentextension']) && $_POST['currentextension'] != '' && |
|
| 14 |
+ isset($_POST['currentchatpubkey']) && $_POST['currentchatpubkey'] != '') {
|
|
| 15 |
+ |
|
| 16 |
+ $sipusersendrec = $_POST['currentextension']; |
|
| 17 |
+ $chatPubKey = $_POST['currentchatpubkey']; |
|
| 18 |
+ |
|
| 19 |
+ // Create the necessary directory if it doesn't exist |
|
| 20 |
+ if (!is_dir('../textchat/' . $sipusersendrec)) {
|
|
| 21 |
+ mkdir('../textchat/' . $sipusersendrec, 0700);
|
|
| 22 |
+ } |
|
| 23 |
+ |
|
| 24 |
+ // Save the RSA public key |
|
| 25 |
+ if ($sipusersendrec != '') {
|
|
| 26 |
+ |
|
| 27 |
+ $savePubKey = file_put_contents('../textchat/' . $sipusersendrec . '/rsa_1024_pub.pem', $chatPubKey);
|
|
| 28 |
+ chmod('../textchat/' . $sipusersendrec . '/rsa_1024_pub.pem', 0600);
|
|
| 29 |
+ $messageres = 'success'; |
|
| 30 |
+ |
|
| 31 |
+ } else {
|
|
| 32 |
+ $messageres = 'failure'; |
|
| 33 |
+ } |
|
| 34 |
+ |
|
| 35 |
+ $generateresp = ['messageres' => $messageres]; |
|
| 36 |
+ |
|
| 37 |
+ echo json_encode($generateresp); |
|
| 38 |
+ |
|
| 39 |
+} else {
|
|
| 40 |
+ header("Location: ../login.php");
|
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+?> |