diff options
author | Minteck <contact@minteck.org> | 2022-08-10 00:04:25 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-10 00:04:25 +0200 |
commit | 0417260bf158c5d7b62888dae2e202b0de115a05 (patch) | |
tree | 7f54ee56da118813f2d1b3a324d322d0c74fa51b /includes/session.php | |
download | pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.gz pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.bz2 pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.zip |
Initial commit
Diffstat (limited to 'includes/session.php')
-rw-r--r-- | includes/session.php | 19 |
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 |