summaryrefslogtreecommitdiff
path: root/includes/session.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-26 22:29:23 +0200
committerMinteck <contact@minteck.org>2022-08-26 22:29:23 +0200
commit09bd0164ebc020a54b944b7326dcba496fb5d82c (patch)
tree0c5e765e627ecc94e534ccb6e2bc83917d58dc4c /includes/session.php
parenta2df9a69dcc14cb70118cda2ded499055e7ee358 (diff)
downloadpluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.gz
pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.bz2
pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.zip
idk when was the last commit so I'm making a new one - Violet Dawn
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