blob: 16171b678872065caecd5f9072dd936fa261b37c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?php
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();
}
$token = bin2hex(random_bytes(96));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/online/private/gametokens/" . $token, json_encode($_DATA));
header("Location: http://localhost:14552/kartik-auth?_=" . $token);
die();
|