blob: b2a3800d84a73453e1bc6d169cd18dd5193acf85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
$list = array_map(function ($i) {
return sha1($i) . md5($i);
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), function ($i) { return !str_starts_with($i, "."); }));
header("Content-Type: text/plain");
$obj = [
"valid" => false,
"user" => null
];
if (isset($_GET["key"])) {
if (in_array($_GET["key"], $list)) {
$obj["valid"] = true;
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), function ($i) { return !str_starts_with($i, "."); }) as $token) {
$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true);
$obj["user"] = $data["login"];
}
}
}
die(json_encode($obj));
|