| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,60 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+/** |
|
| 4 |
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com> |
|
| 5 |
+ * |
|
| 6 |
+ * @author Double Bastion LLC |
|
| 7 |
+ * |
|
| 8 |
+ * @license GNU AGPL version 3 or any later version |
|
| 9 |
+ * |
|
| 10 |
+ * This program is free software; you can redistribute it and/or |
|
| 11 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 12 |
+ * License as published by the Free Software Foundation; either |
|
| 13 |
+ * version 3 of the License, or any later version. |
|
| 14 |
+ * |
|
| 15 |
+ * This program is distributed in the hope that it will be useful, |
|
| 16 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 19 |
+ * |
|
| 20 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 21 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 22 |
+ * |
|
| 23 |
+ */ |
|
| 24 |
+ |
|
| 25 |
+session_start(); |
|
| 26 |
+ |
|
| 27 |
+if (($_SESSION['loggedtorspanel'] == true) && ($_SESSION['userrole'] == 'superadmin')) {
|
|
| 28 |
+ |
|
| 29 |
+ if (isset($_FILES['uploadedimage'])) {
|
|
| 30 |
+ |
|
| 31 |
+ $fileContent = file_get_contents($_FILES['uploadedimage']['tmp_name']); |
|
| 32 |
+ $fileName = $_FILES['uploadedimage']['name']; |
|
| 33 |
+ |
|
| 34 |
+ // Check if there is another file with the same name in the upload directory |
|
| 35 |
+ if (file_exists("images/buttons/".$fileName)) {
|
|
| 36 |
+ $uniquefilemessage = "A file with the same name is already in the upload directory. The new file will overwrite the old file !"; |
|
| 37 |
+ } else {
|
|
| 38 |
+ $uniquefilemessage = ""; |
|
| 39 |
+ } |
|
| 40 |
+ |
|
| 41 |
+ file_put_contents("images/buttons/".$fileName, $fileContent);
|
|
| 42 |
+ |
|
| 43 |
+ $result = array( |
|
| 44 |
+ 'messageonsave' => $uniquefilemessage |
|
| 45 |
+ ); |
|
| 46 |
+ |
|
| 47 |
+ echo json_encode($result); |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ |
|
| 51 |
+} elseif (empty($_SESSION['loggedtorspanel'])) {
|
|
| 52 |
+ |
|
| 53 |
+ header("Location: panel-login.php");
|
|
| 54 |
+ |
|
| 55 |
+} elseif (($_SESSION['loggedtorspanel'] == true) && ($_SESSION['userrole'] != 'superadmin')) {
|
|
| 56 |
+ |
|
| 57 |
+ header("Location: index.php");
|
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+?> |