summaryrefslogtreecommitdiff
path: root/Application/SetCurrentIdentity/index.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-07-11 18:54:47 +0200
committerMinteck <contact@minteck.org>2022-07-11 18:54:47 +0200
commitf70cf5893bb775625e79ed959721ede03e34a108 (patch)
treeb43b6c392d580304fb47777d240f529e92ea17b0 /Application/SetCurrentIdentity/index.php
parent2629b95c437cce1d331d8f4ab3a0d1ff394930a7 (diff)
downloadbits-server-mane.tar.gz
bits-server-mane.tar.bz2
bits-server-mane.zip
UpdateHEADmane
Diffstat (limited to 'Application/SetCurrentIdentity/index.php')
-rw-r--r--Application/SetCurrentIdentity/index.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/Application/SetCurrentIdentity/index.php b/Application/SetCurrentIdentity/index.php
new file mode 100644
index 0000000..d7603dd
--- /dev/null
+++ b/Application/SetCurrentIdentity/index.php
@@ -0,0 +1,22 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/Private/SessionManager.php"; global $_PROFILE;
+header("Content-Type: application/json");
+
+$identities = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Identities.json"), true);
+
+if (!isset($_GET['Name']) || !isset($_GET['Picture'])) {
+ die();
+}
+
+function base64url_decode($data, $strict = false): string {
+ $b64 = strtr($data, '-_', '+/');
+ return base64_decode($b64, $strict);
+}
+
+$identities[$_PROFILE["id"]]["name"] = base64url_decode($_GET['Name']);
+$identities[$_PROFILE["id"]]["picture"] = base64url_decode($_GET['Picture']);
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Identities.json", json_encode($identities, JSON_PRETTY_PRINT));
+
+die(); \ No newline at end of file