diff options
author | RaindropsSys <contact@minteck.org> | 2023-05-20 22:48:50 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-05-20 22:48:50 +0200 |
commit | 9fa1a90eea40b0543f2c6b276463cad963376a42 (patch) | |
tree | 5fe5212aece9f187d145811c1907dd74de9e7343 /pages/api | |
parent | 5e768d30a0c8ea53423cc4f077c8f37381b8cbb3 (diff) | |
download | pluralconnect-9fa1a90eea40b0543f2c6b276463cad963376a42.tar.gz pluralconnect-9fa1a90eea40b0543f2c6b276463cad963376a42.tar.bz2 pluralconnect-9fa1a90eea40b0543f2c6b276463cad963376a42.zip |
Updated 2 files (automated)
Diffstat (limited to 'pages/api')
-rw-r--r-- | pages/api/reauthenticate.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pages/api/reauthenticate.php b/pages/api/reauthenticate.php index e726e8e..fe10d28 100644 --- a/pages/api/reauthenticate.php +++ b/pages/api/reauthenticate.php @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; header("Content-Type: text/plain"); @@ -12,14 +12,24 @@ if (!$isLoggedIn || $isLowerLoggedIn) { $newToken = generateToken(); -if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) { +if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLoggedIn) { $old = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['PEH2_SESSION_TOKEN']), true); $old["name"] = base64_decode($_GET["name"] ?? "LQo="); $old["created"] = time(); $old["addresses"] = []; $old["last"] = time(); + $old["profile"] = $_PROFILE; file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $newToken, json_encode($old)); +} else if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLowerLoggedIn) { + $old = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $_COOKIE['PEH2_SESSION_TOKEN']), true); + $old["name"] = base64_decode($_GET["name"] ?? "LQo="); + $old["created"] = time(); + $old["addresses"] = []; + $old["last"] = time(); + $old["profile"] = $_PROFILE; + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $newToken, json_encode($old)); } die($newToken);
\ No newline at end of file |