summaryrefslogtreecommitdiff
path: root/includes/session.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/session.php')
-rw-r--r--includes/session.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/includes/session.php b/includes/session.php
index 27acf6b..2157f5f 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -1,6 +1,7 @@
<?php
global $isLoggedIn;
+global $isUserLoggedIn;
global $_PROFILE;
if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
@@ -16,4 +17,19 @@ if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
}
} 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