diff options
Diffstat (limited to 'pages/api/rename.php')
-rw-r--r-- | pages/api/rename.php | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/pages/api/rename.php b/pages/api/rename.php deleted file mode 100644 index 4e01b06..0000000 --- a/pages/api/rename.php +++ /dev/null @@ -1,37 +0,0 @@ -<?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(); -} - -$obj = [ - "success" => true -]; - -global $token; -$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . str_replace("/", "", $token))), true); - -$data["name"] = $_POST["name"] ?? $_GET["name"] ?? $data["name"]; -$obj["pre_name"] = $data["name"]; - -$request_raw = file_get_contents('php://input'); -$json_object = json_decode($request_raw, true); - -if (json_last_error() === JSON_ERROR_NONE) { - $obj["json_error"] = [ json_last_error(), json_last_error_msg() ]; - if (isset($json_object["name"])) { - $data["name"] = $json_object["name"]; - $obj["json_name"] = $json_object["name"]; - } -} - -$obj["new_name"] = $data["name"]; - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . str_replace("/", "", $token), pf_utf8_encode(json_encode($data))); -die(json_encode($obj));
\ No newline at end of file |