aboutsummaryrefslogtreecommitdiff
path: root/admin/api/terminateAllSessions.php
blob: 46c1b339eecf8ecacaff82a39fc0f53b46574682 (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
25
26
27
28
29
30
31
32
33
34
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";

if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
    $arg = $_GET['_'];
} else {
    die();
}

$webs = scandir("/mnt/kartik/online/private/tokens");

foreach ($webs as $webt) {
    if (!is_dir("/mnt/kartik/online/private/tokens/" . $webt)) {
        $d = json_decode(file_get_contents("/mnt/kartik/online/private/tokens/" . $webt), true);
        if ($d["id"] === $arg) {
            unlink("/mnt/kartik/online/private/tokens/" . $webt);
        }
    }
}

$webs = scandir("/mnt/kartik/online/private/gametokens");

foreach ($webs as $webt) {
    if (!is_dir("/mnt/kartik/online/private/gametokens/" . $webt)) {
        $d = json_decode(file_get_contents("/mnt/kartik/online/private/gametokens/" . $webt), true);
        if ($d["id"] === $arg) {
            unlink("/mnt/kartik/online/private/gametokens/" . $webt);
        }
    }
}

header("Location: /admin/panes/kartik.php");
die();