summaryrefslogtreecommitdiff
path: root/includes/session.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/session.php')
-rw-r--r--includes/session.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/includes/session.php b/includes/session.php
new file mode 100644
index 0000000..27acf6b
--- /dev/null
+++ b/includes/session.php
@@ -0,0 +1,19 @@
+<?php
+
+global $isLoggedIn;
+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);
+ $isLoggedIn = true;
+ } else {
+ $isLoggedIn = false;
+ }
+} else {
+ $isLoggedIn = false;
+} \ No newline at end of file