summaryrefslogtreecommitdiff
path: root/pages/api/reauthenticate.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
commit5860551daa0f60103ad24e93da29f401a653f144 (patch)
tree9ad97e04152a6edc11d5096c87880978df39086a /pages/api/reauthenticate.php
parenta51979ad60074db84af78a06d30fcb888ccb0b03 (diff)
downloadpluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'pages/api/reauthenticate.php')
-rw-r--r--pages/api/reauthenticate.php49
1 files changed, 0 insertions, 49 deletions
diff --git a/pages/api/reauthenticate.php b/pages/api/reauthenticate.php
deleted file mode 100644
index b194098..0000000
--- a/pages/api/reauthenticate.php
+++ /dev/null
@@ -1,49 +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; global $_PROFILE;
-
-header("Content-Type: text/plain");
-
-if (!$isLoggedIn || $isLowerLoggedIn) {
- header("Location: /-/login");
- die();
-}
-
-$newToken = generateToken();
-
-if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLoggedIn) {
- $old = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['PEH2_SESSION_TOKEN']), true);
-
- if (!isset($_GET["plain"])) {
- $old["name"] = base64_decode($_GET["name"] ?? "LQo=");
- } else {
- $old["name"] = $_GET["name"] ?? "-";
- }
-
- $old["created"] = time();
- $old["addresses"] = [];
- $old["last"] = time();
- $old["profile"] = $_PROFILE;
-
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . $newToken, json_encode($old));
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $newToken, json_encode($_PROFILE));
-} else if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLowerLoggedIn) {
- $old = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . $_COOKIE['PEH2_SESSION_TOKEN']), true);
-
- if (!isset($_GET["plain"])) {
- $old["name"] = base64_decode($_GET["name"] ?? "LQo=");
- } else {
- $old["name"] = $_GET["name"] ?? "-";
- }
-
- $old["created"] = time();
- $old["addresses"] = [];
- $old["last"] = time();
- $old["profile"] = $_PROFILE;
-
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . $newToken, json_encode($old));
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $newToken, json_encode($_PROFILE));
-}
-
-die($newToken); \ No newline at end of file