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
+// // 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'])) {
14
+
15
+  $userName = $_POST['username'];
16
+  $removedFileName = $_POST['removedfilename'];
17
+  $resmessage = "";
18
+  $totalFileSize = "";
19
+
20
+  $filePath = "../fax/temp_files/" . $userName . "/" . $removedFileName;
21
+
22
+  if (file_exists($filePath)) {
23
+      if (unlink($filePath)) { $resmessage = 'success'; } else { $resmessage = 'failure'; }
24
+  }
25
+
26
+  // Get the cumulative files size of the uploaded files
27
+  $targetdir = "../fax/temp_files/" . $userName;
28
+  $totalFlSize = 0;
29
+
30
+  foreach (new DirectoryIterator($targetdir) as $file) {
31
+           if ($file->isFile()) {
32
+	       $totalFlSize += number_format(($file->getSize() / 1048576), 2);
33
+	   }
34
+  }
35
+
36
+  $totalFileSize = $totalFlSize . " MB";
37
+
38
+  $respdata = ['result' => $resmessage, 'totalflsize' => $totalFileSize];
39
+
40
+  echo json_encode($respdata);
41
+
42
+} else {
43
+       header("Location: ../login.php");
44
+}
45
+
46
+?>