$s = str_replace("-", "", trim($s));
    for ($i = 0; $i < 4; $i++) {
        $sub[$i] = intval("0x" . substr($s, $i * 8, 8) + 0, 16);
    }
    return $sub[0] ^ $sub[1] ^ ($sub[2] ^ $sub[3]);
}
if ($_GET["name"]) {
    $json = file_get_contents("https://api.mojang.com/users/profiles/minecraft/" . $_GET["name"]);
    $id = json_decode($json);
    if (!$id->id) {
        echo "Error: Can't get UUID from mojang.com";
    } elseif (hashCode($id->id) % 2) {
        echo "Alex";
    } else {
        echo "Steve";
    }
    if ($id->legacy) {
        echo "<br>Account not migrated!";
    }
    //echo "<br><br>" . $json;
} elseif ($_GET["uuid"]) {
    //$json = file_get_contents("https://api.mojang.com/users/profiles/" . $_GET["uuid"] . "/names");
    if (hashCode($_GET["uuid"]) % 2) {
        echo "Alex";
    } else {
        echo "Steve";
    }
    //echo $json;
} else {
    echo "Use ?uuid=YOUR_UUID";
}
 public function hashCode()
 {
     return 31 * $this->size + hashCode($this->bits);
 }
Beispiel #3
0
    $charid = strtoupper(md5(uniqid(mt_rand(), true)));
    $hyphen = chr(45);
    // "-"
    $uuid = chr(123) . substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12) . chr(125);
    // "}"
    return $uuid;
}
try {
    $apiDomain = GetDomainAccount();
    $apiKey = GetDomainApiKey();
    $content = $_POST['content'];
    $subject = $_POST['subject'];
    $toEmail = $_POST['toEmail'];
    $content = $content . "<br/><br/>TickId:" . GetGuidString();
    $mailArr = explode("@", $toEmail);
    $mailIndex = abs(hashCode($mailArr[0]) % count($apiDomain));
    //$mailIndex=3;
    $domain = $apiDomain[$mailIndex];
    $domailKey = $apiKey[$mailIndex];
    $sendByEmail = "TBcustomerService<support" . "@" . $domain . ">";
    $mg = new Mailgun($domailKey);
    $result = $mg->sendMessage($domain, array('from' => $sendByEmail, 'to' => $toEmail, 'subject' => $subject, 'html' => $content));
    $jsonData = json_encode($result);
    $jsonString = json_decode($jsonData, true);
    $httpCode = $jsonString['http_response_code'];
    $returnMsg = $jsonString['http_response_body']['message'];
    print_r($httpCode . ":" . $returnMsg);
} catch (Exception $e) {
    print "Failed:";
    print_r($e->getMessage());
}
 public function hashCode()
 {
     $hash = $this->width;
     $hash = 31 * $hash + $this->width;
     $hash = 31 * $hash + $this->height;
     $hash = 31 * $hash + $this->rowSize;
     $hash = 31 * $hash + hashCode($this->bits);
     return $hash;
 }