Stránka 1 z 3
[PHP] UUID - offline mode nicky
Napsal: 13 črc 2014, 23:51
od zdenda204
Spousta z Vás má jistě trable s tím, jak zjistit UUID pro hráče, který si hru nezakoupil.
Tento kód si uložte na svůj web a pak pouze stačí do adresy zadat uživatelské jméno (Příklad:
http://www.epic.cz/skript.php?nick=zdenda204)
<?php
function uuidFromString($string) {
$val = md5($string, true);
$byte = array_values(unpack('C16', $val));
$tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3];
$tMi = ($byte[4] << 8) | $byte[5];
$tHi = ($byte[6] << 8) | $byte[7];
$csLo = $byte[9];
$csHi = $byte[8] & 0x3f | (1 << 7);
if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) {
$tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24);
$tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8);
$tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8);
}
$tHi &= 0x0fff;
$tHi |= (3 << 12);
$uuid = sprintf(
'%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
$tLo, $tMi, $tHi, $csHi, $csLo,
$byte[10], $byte[11], $byte[12], $byte[13], $byte[14], $byte[15]
);
return $uuid;
}
function uuidConvert($string)
{
$string = uuidFromString("OfflinePlayer:".$string);
return $string;
}
var_dump(uuidConvert($_GET['nick']));
Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 00:39
od siOnzee
Dobře ty. Na tyhle blásty jsem nikdy neměl náladu, chce to moc přemýšlení a už jen vymyslet celej ten algoritmus je na hrozně dlouho.
Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 11:07
od Mysteria
To jsi psal ty sám?

Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 11:35
od vojtamaniak
Samozřejmě že to psal sám, máš ho snad za podvodníka?
[Pro všechny kromě zdendy](Nepsal, samozřejmě

)[/Pro všechny kromě zdendy]
Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 12:44
od Mysteria
Myslel jsem si to, protože né že bych ho podceňoval, ale tyhle bitové operace a další věci nejsou zrovna nejlehčí věc na pochopení.

Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 12:53
od V886b
co je uuid
-- 14 črc 2014, 11:54 --
pls co to je
Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 13:01
od LpBahos
Kód: Vybrat vše
<?php
/*
* Example of using the Classes.
*/
$profile = ProfileUtils::getProfile("Shadowwolf97");
$result = $profile->getProfileAsArray();
echo 'username: '.$result['username'].'<br>';
echo 'uuid: '.$result['uuid'].'<br/>';
//I am honestly not sure what the properties are at this point, but I included them just in case they are needed.
//echo 'properties: '.$result['properties'].'<br />';
$profile = ProfileUtils::getProfile("c465b1543c294dbfa7e3e0869504b8d8");
$result = $profile->getProfileAsArray();
echo 'username: '.$result['username'].'<br>';
echo 'uuid: '.$result['uuid'].'<br/>';
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * *
* OutPuts *
* * * * * * * * * * * * * * * * * * * * * * * * * * *
* username: KingTiger
* uuid: 34346c234f8a4736b2cd79bd9c8d91b0
*/
class MinecraftProfile {
private $username;
private $uuid;
private $properties;
/**
* @param string $username The player's username.
* @param string $uuid The player's UUID.
* @param array $properties The player's properties specified on their Mojang profile.
*/
function __CONSTRUCT($username, $uuid, $properties = array()) {
$this->username = $username;
$this->uuid = $uuid;
$this->properties = $properties;
}
/**
* @return string The player's username.
*/
public function getUsername() {
return $this->username;
}
/**
* @return string The player's UUID.
*/
public function getUUID() {
return $this->uuid;
}
/**
* @return array The player's properties listed on their mojang profile.
*/
public function getProperties() {
return $this->properties;
}
/**
* @return array Returns an array with keys of 'properties, usernname and uuid'.
*/
public function getProfileAsArray() {
return array("username" => $this->username, "uuid" => $this->uuid, "properties" => $this->properties);
}
}
class ProfileUtils {
/**
* @param string $identifier Either the player's Username or UUID.
* @param int $timeout The length in seconds of the http request timeout.
* @return MinecraftProfile|null Returns null if fetching of profile failed. Else returns completed user profile.
*/
public static function getProfile($identifier, $timeout = 5) {
if(strlen($identifier) <= 16)
$identifier = ProfileUtils::getUUIDFromUsername($identifier, $timeout)['uuid'];
$url = "https://sessionserver.mojang.com/session/minecraft/profile/".$identifier;
$ctx = stream_context_create(array(
'http' => array(
'timeout' => $timeout
)
)
);
$ret = file_get_contents($url, 0, $ctx);
if(isset($ret) && $ret != null && $ret != false) {
$data = json_decode($ret, true);
return new MinecraftProfile($data['name'], $data['id'], $data['properties']);
}else {
return null;
}
}
/**
* @param int $timeout http timeout in seconds
* @param $username string Minecraft username.
* @return array (Key => Value) "username" => Minecraft username (properly capitalized) "uuid" => Minecraft UUID
*/
public static function getUUIDFromUsername($username, $timeout = 5) {
if(strlen($username) > 16)
return array("username" => "", "uuid" => "");
$url = 'https://api.mojang.com/profiles/page/1';
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => '{"name":"'.$username.'","agent":"minecraft"}',
'timeout' => $timeout
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
// Verification
if(isset($result) && $result != null && $result != false)
{
$ress = json_decode($result, true);
$ress = $ress["profiles"][0];
$res = Array("username" => $ress['name'], "uuid" => $ress['id']);
return $res;
}
else
return null;
}
/**
* @param $uuid string UUID to format
* @return string Properly formatted UUID (According to UUID v4 Standards xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx WHERE y = 8,9,A,or B and x = random digits.)
*/
public static function formatUUID($uuid) {
$uid = "";
$uid .= substr($uuid, 0, 8)."-";
$uid .= substr($uuid, 8, 4)."-";
$uid .= substr($uuid, 12, 4)."-";
$uid .= substr($uuid, 16, 4)."-";
$uid .= substr($uuid, 20);
return $uid;
}
}
Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 13:35
od nejento
Re: [PHP] UUID - warez nicky
Napsal: 14 črc 2014, 13:38
od zdenda204
Bahosi, to je jen na online UUID, ne?
Mysty, samozřejmě že jsem to nepsal

Toto jde naprosto mimo mě, netuším stále co to dělá

Každopádně bych uvedl autora, jenže jaksi nevím kde jsem to tenkrát našel

Re: [PHP] UUID - offline mode nicky
Napsal: 14 črc 2014, 13:47
od Mysteria
To jeho je jenom pro newarez, to tvoje je i pro warez, takže lepší.

Rozhodně se bude hodit. No, jak jsem říkal bitový operace no... taky bych ti neřekl co přesně to dělá každý kus.
