true ]; global $token; $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . 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/tokens/" . str_replace("/", "", $token), json_encode($data)); die(json_encode($obj));