summaryrefslogtreecommitdiff
path: root/includes/session.locked.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-05-22 18:16:34 +0200
committerMinteck <contact@minteck.org>2022-05-22 18:16:34 +0200
commitbc4d21ddbc50a4295ad1be0f4797b09895a65fea (patch)
treef915c08fba577daf766628657558ce480790b06f /includes/session.locked.php
downloadmultisocial-bc4d21ddbc50a4295ad1be0f4797b09895a65fea.tar.gz
multisocial-bc4d21ddbc50a4295ad1be0f4797b09895a65fea.tar.bz2
multisocial-bc4d21ddbc50a4295ad1be0f4797b09895a65fea.zip
Initial commitHEADmane
Diffstat (limited to 'includes/session.locked.php')
-rw-r--r--includes/session.locked.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/includes/session.locked.php b/includes/session.locked.php
new file mode 100644
index 0000000..c3fc82a
--- /dev/null
+++ b/includes/session.locked.php
@@ -0,0 +1,30 @@
+<?php
+
+if (isset($_COOKIE['MMSP_SESSION_TOKEN'])) {
+ if (str_contains($_COOKIE['MMSP_SESSION_TOKEN'], ".") || str_contains($_COOKIE['MMSP_SESSION_TOKEN'], "/")) {
+ header("Location: /explore");
+ die();
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['MMSP_SESSION_TOKEN'])))) {
+ $_PROFILE = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['MMSP_SESSION_TOKEN']))), true);
+
+ $users = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/users.json"), true);
+
+ if (in_array($_PROFILE['id'], array_keys($users)) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/" . $users[$_PROFILE['id']])) {
+ $_PROFILE['mmsp_username'] = $users[$_PROFILE['id']];
+ $_USER = $_PROFILE['login'];
+ $_SUID = $_PROFILE['login'];
+ $_FULLNAME = $_PROFILE['name'];
+ } else {
+ header("Location: /initial");
+ die();
+ }
+ } else {
+ header("Location: /explore");
+ die();
+ }
+} else {
+ header("Location: /explore");
+ die();
+} \ No newline at end of file