summaryrefslogtreecommitdiff
path: root/includes/util/session.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/util/session.inc')
-rw-r--r--includes/util/session.inc16
1 files changed, 9 insertions, 7 deletions
diff --git a/includes/util/session.inc b/includes/util/session.inc
index 63197bb..7554cfa 100644
--- a/includes/util/session.inc
+++ b/includes/util/session.inc
@@ -40,10 +40,6 @@ if (isset($token)) {
if (isset($data["profile"])) {
$_PROFILE = $data["profile"];
- $data["last"] = time();
- if (!isset($data["addresses"])) $data["addresses"] = [];
- $data["addresses"][$_SERVER["HTTP_X_FORWARDED_FOR"] ?? $_SERVER["REMOTE_ADDR"]] = time();
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token), json_encode($data));
if (time() - $data["last"] > 86400 * 30) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token));
@@ -51,6 +47,11 @@ if (isset($token)) {
$isLoggedIn = false;
$isLowerLoggedIn = false;
}
+
+ $data["last"] = time();
+ if (!isset($data["addresses"])) $data["addresses"] = [];
+ $data["addresses"][$_SERVER["HTTP_X_FORWARDED_FOR"] ?? $_SERVER["REMOTE_ADDR"]] = time();
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token), json_encode($data));
} else {
$_PROFILE = $data;
}
@@ -66,9 +67,6 @@ if (isset($token)) {
if (isset($data["profile"])) {
$_PROFILE = $data["profile"];
- $data["last"] = time();
- $data["addresses"][$_SERVER["HTTP_X_FORWARDED_FOR"] ?? $_SERVER["REMOTE_ADDR"]] = time();
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token), json_encode($data));
if (time() - $data["last"] > 86400 * 30) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token));
@@ -76,6 +74,10 @@ if (isset($token)) {
$isLoggedIn = false;
$isLowerLoggedIn = false;
}
+
+ $data["last"] = time();
+ $data["addresses"][$_SERVER["HTTP_X_FORWARDED_FOR"] ?? $_SERVER["REMOTE_ADDR"]] = time();
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token), json_encode($data));
} else {
$_PROFILE = $data;
}