summaryrefslogtreecommitdiff
path: root/pages/api/disconnect.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
commit953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch)
tree8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /pages/api/disconnect.php
parent62a9199846b0c07c03218703b33e8385764f42d9 (diff)
downloadpluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'pages/api/disconnect.php')
-rw-r--r--pages/api/disconnect.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/pages/api/disconnect.php b/pages/api/disconnect.php
index c4cf0bd..ffd3f40 100644
--- a/pages/api/disconnect.php
+++ b/pages/api/disconnect.php
@@ -13,13 +13,21 @@ $list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens")
$session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true);
- return isset($session["last"]) && isset($session["profile"]) && ($session["profile"]["id"] ?? "") === ($_PROFILE["id"] ?? "");
+ return isset($session["id"]) && $session["id"] === ($_PROFILE["id"] ?? "");
});
+var_dump($list);
+
foreach ($list as $token) {
$session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true);
- if (isset($_GET["id"]) && sha1($token) . md5($token) === $_GET["id"]) {
+ var_dump(bin2hex(substr($token, 0, 50)), trim($_GET["id"]));
+
+ if (bin2hex(substr($token, 0, 50)) === trim($_GET["id"])) {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . $token)) {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . $token);
+ }
+
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token)) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token);
} else {