summaryrefslogtreecommitdiff
path: root/includes/util/session.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/util/session.inc')
-rw-r--r--includes/util/session.inc29
1 files changed, 29 insertions, 0 deletions
diff --git a/includes/util/session.inc b/includes/util/session.inc
new file mode 100644
index 0000000..7a6b931
--- /dev/null
+++ b/includes/util/session.inc
@@ -0,0 +1,29 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
+
+global $isLoggedIn;
+global $isLowerLoggedIn;
+global $_PROFILE;
+
+$isLoggedIn = false;
+$isLowerLoggedIn = false;
+
+if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
+ if (!(str_contains($_COOKIE['PEH2_SESSION_TOKEN'], ".") || str_contains($_COOKIE['PEH2_SESSION_TOKEN'], "/") || trim($_COOKIE["PEH2_SESSION_TOKEN"]) === "")) {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])))) {
+ $_PROFILE = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN']))), true);
+
+ if (isset($_GET['invert'])) {
+ $_PROFILE["login"] = $_PROFILE["login"] === "raindrops" ? "cloudburst" : "raindrops";
+ $_PROFILE["name"] = $_PROFILE["name"] === "Raindrops System" ? "Cloudburst System" : "Raindrops System";
+ }
+
+ $isLoggedIn = true;
+ } elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])))) {
+ $_PROFILE = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN']))), true);
+
+ $isLowerLoggedIn = true;
+ }
+ }
+} \ No newline at end of file