示例#1
0
function returnProfile($profile)
{
    // Успешная аутентификация
    global $invalidateAllClientTokens;
    if ($invalidateAllClientTokens) {
        invalidateAllTokens($profile['uuid']);
    }
    replaceToken($profile['uuid'], $profile['clientToken'], $profile['accessToken']);
    updateProvider($profile['uuid'], $profile['provider'], $profile['provider'] != "mojang");
    // Настало время охуительных историй
    $profile['uuid'] = logAsHackedProfile($profile['uuid']);
    $profile['name'] = getProfileName($profile['uuid']);
    // Выбранный профиль
    $gameProfile = array("id" => $profile['uuid'], "name" => $profile['name'], "legacy" => 'false');
    // Конечный результат
    $response = array("accessToken" => $profile['accessToken'], "clientToken" => $profile['clientToken'], "selectedProfile" => $gameProfile, "availableProfiles" => array($gameProfile), "provider" => $profile['provider'], "role" => $profile['role']);
    response($response);
}
    $result = $authserver->query($query) or responseWithError("InternalDatabaseError", $authserver->error);
    if ($result->num_rows == 1) {
        // Информация найдена
        $row = $result->fetch_assoc();
        $uuid = $row['uuid'];
        $name = getProfileName($uuid);
        // Удаляю временную строку входа на сервер + очень устаревшие записи
        cleanupJoins($row['accessToken']);
    }
}
// Никого не найдено
if ($uuid === null) {
    responseWithError("No");
}
// Применить адское хакерство
$uuid = logAsHackedProfile($uuid);
$name = getProfileName($uuid);
$hasTextures = false;
// Если лицензия предоставляет скин, запомним его в нашей базе
if (is_array($properties)) {
    foreach ($properties as $prop) {
        if ($prop['name'] == "textures") {
            $decoded = json_decode(base64_decode($prop['value']), true);
            $propTextures = $decoded['textures'];
            setProfileClothes($uuid, $propTextures);
            $hasTextures = true;
        }
    }
}
if (!$hasTextures) {
    $properties = getProfileProps($uuid, $name);