blob: 36ecda606ef6b2805b74fc4c4e48d78e71b95ba0 (
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
|
<?php
if (!isset($_GET['_'])) {
header("Location: /online");
die();
} else if (!ctype_alnum($_GET['_'])) {
header("Location: /online");
die();
}
if (!isset($_COOKIE["kartik_online_token"])) {
header("Location: https://jetbrains.minteck.ro.lt:1024/hub/hub/api/rest/oauth2/auth?client_id=2d3ca3a8-38b7-4193-990a-a9454bb8d44c&response_type=code&redirect_uri=https://kartik.hopto.org/online/callback_ig&scope=hub&request_credentials=default&access_type=offline");
die();
} else if (ctype_xdigit($_COOKIE["kartik_online_token"]) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/online/private/tokens/" . $_COOKIE['kartik_online_token'])) {
$_DATA = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/online/private/tokens/" . $_COOKIE['kartik_online_token']), true);
} else {
header("Location: https://jetbrains.minteck.ro.lt:1024/hub/hub/api/rest/oauth2/auth?client_id=2d3ca3a8-38b7-4193-990a-a9454bb8d44c&response_type=code&redirect_uri=https://kartik.hopto.org/online/callback_ig&scope=hub&request_credentials=default&access_type=offline");
die();
}
foreach (scandir($_SERVER['DOCUMENT_ROOT'] . "/online/private/gametokens") as $token) {
if (trim($token) !== "." && trim($token) !== ".." && json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/online/private/gametokens/" . $token), true)["id"] === $_DATA["id"] && substr($token, 0, strlen($_GET['_'])) === $_GET['_']) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/online/private/gametokens/" . $token);
}
}
header("Location: /online");
die();
|