summaryrefslogtreecommitdiff
path: root/includes/session.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/session.inc')
-rw-r--r--includes/session.inc41
1 files changed, 41 insertions, 0 deletions
diff --git a/includes/session.inc b/includes/session.inc
new file mode 100644
index 0000000..b440c9c
--- /dev/null
+++ b/includes/session.inc
@@ -0,0 +1,41 @@
+<?php
+
+global $isLoggedIn;
+global $isUserLoggedIn;
+global $_PROFILE;
+
+if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
+ if (str_contains($_COOKIE['PEH2_SESSION_TOKEN'], ".") || str_contains($_COOKIE['PEH2_SESSION_TOKEN'], "/")) {
+ $isLoggedIn = false;
+ }
+
+ 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;
+ } else {
+ $isLoggedIn = false;
+ }
+} else {
+ $isLoggedIn = false;
+}
+
+if (isset($_COOKIE['PEH2_USER_TOKEN'])) {
+ if (str_contains($_COOKIE['PEH2_USER_TOKEN'], ".") || str_contains($_COOKIE['PEH2_USER_TOKEN'], "/")) {
+ $isUserLoggedIn = false;
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_USER_TOKEN'])))) {
+ $_PROFILE = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_USER_TOKEN']))), true);
+ $isUserLoggedIn = true;
+ } else {
+ $isUserLoggedIn = false;
+ }
+} else {
+ $isUserLoggedIn = false;
+} \ No newline at end of file