diff options
Diffstat (limited to 'pages/api/computername.php')
-rw-r--r-- | pages/api/computername.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pages/api/computername.php b/pages/api/computername.php new file mode 100644 index 0000000..1a719b0 --- /dev/null +++ b/pages/api/computername.php @@ -0,0 +1,10 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; +if (!$isLoggedIn) header("Location: /-/login") and die(); + +$names = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json"), true); +$names[$_GET["id"]] = $_GET["name"]; +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json", json_encode($names)); + +die();
\ No newline at end of file |