summaryrefslogtreecommitdiff
path: root/pages/api/rename.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/api/rename.php')
-rw-r--r--pages/api/rename.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/pages/api/rename.php b/pages/api/rename.php
new file mode 100644
index 0000000..d450557
--- /dev/null
+++ b/pages/api/rename.php
@@ -0,0 +1,17 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
+
+header("Content-Type: application/json");
+
+if (!$isLoggedIn || $isLowerLoggedIn) {
+ header("Location: /-/login");
+ die();
+}
+
+$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])), true);
+
+$data["name"] = $_GET["name"] ?? $data["name"];
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN']), json_encode($data)); \ No newline at end of file