summaryrefslogtreecommitdiff
path: root/pages/api/disconnect.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
commit5860551daa0f60103ad24e93da29f401a653f144 (patch)
tree9ad97e04152a6edc11d5096c87880978df39086a /pages/api/disconnect.php
parenta51979ad60074db84af78a06d30fcb888ccb0b03 (diff)
downloadpluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'pages/api/disconnect.php')
-rw-r--r--pages/api/disconnect.php37
1 files changed, 0 insertions, 37 deletions
diff --git a/pages/api/disconnect.php b/pages/api/disconnect.php
deleted file mode 100644
index ffd3f40..0000000
--- a/pages/api/disconnect.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE;
-if (!$isLoggedIn && !$isLowerLoggedIn) {
- header("Location: /-/login");
- die();
-}
-
-$list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), ...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")], function ($token) {
- global $_PROFILE;
- if ($token === "." || $token === "..") return false;
-
- $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["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);
-
- 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 {
- unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token);
- }
- }
-} \ No newline at end of file