Minecraft Name History - http://www.LB-Stuff.com/Minecraft-Name-History - really hacky PHP script, available in public domain
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Minecraft Name History - Nicholas "LB" Braden</title> | |
<link rel="canonical" href="http://www.LB-Stuff.com/Minecraft-Name-History" /> | |
<link rel="stylesheet" href="/light.css" /> | |
<link rel="icon" type="image/png" href="/LB.png" /> | |
<script src="https://apis.google.com/js/platform.js" async defer></script> | |
</head> | |
<body> | |
<?php include 'ga.php'; ?> | |
<h1>Minecraft Name History</h1> | |
<div class="g-plusone" data-annotation="inline" data-width="450"></div> | |
<p>Enter a <em>current</em> or <em>original</em> Minecraft username, or a UUID, and click the button to get the name history.</p> | |
<form action="?" method="get"> | |
<input type="text" name="user" value="<?php echo(htmlspecialchars($_GET['user'])); ?>" required> | |
<input type="submit" value="History Lesson"> | |
</form> | |
<?php | |
$user = $_GET['user']; | |
if(strlen($user) > 0) | |
{ | |
$name = null; | |
$uuid = null; | |
if(strlen($user) <= 16) | |
{ | |
$name = $user; | |
$c = curl_init('https://api.mojang.com/users/profiles/minecraft/'.$name); | |
curl_setopt($c, CURLOPT_POST, 0); | |
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt($c, CURLOPT_HEADER, 0); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
$result = curl_exec($c); | |
curl_close($c); | |
$data = json_decode($result, true); | |
if(isset($data['id'])) | |
{ | |
$uuid = $data['id']; | |
} | |
else | |
{ | |
$c = curl_init('https://api.mojang.com/users/profiles/minecraft/'.$name.'?at=1422986400'); | |
curl_setopt($c, CURLOPT_POST, 0); | |
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt($c, CURLOPT_HEADER, 0); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
$result = curl_exec($c); | |
curl_close($c); | |
$data = json_decode($result, true); | |
if(isset($data['id'])) | |
{ | |
$uuid = $data['id']; | |
} | |
else | |
{ | |
?> | |
<p style="color: red;">Could not get player UUID.</p> | |
<?php | |
} | |
} | |
} | |
else $uuid = $user; | |
$c = curl_init('https://api.mojang.com/user/profiles/'.$uuid.'/names'); | |
curl_setopt($c, CURLOPT_POST, 0); | |
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt($c, CURLOPT_HEADER, 0); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
$result = curl_exec($c); | |
curl_close($c); | |
$data = json_decode($result, true); | |
if(isset($data[0]['name'])) | |
{ | |
if($name != null) | |
{ | |
?> | |
<p>UUID for <code><?php echo(htmlspecialchars($name)); ?></code> is <code><?php echo(htmlspecialchars($uuid)) ?></code></p> | |
<?php | |
} | |
?> | |
<table> | |
<tr><th>Date</th><th>Username</th></tr> | |
<tr><td>Original</td><td><code><?php echo(htmlspecialchars($data[0]['name'])); ?></code></td></tr> | |
<?php | |
$i = 0; | |
while(isset($data[++$i])) | |
{ | |
?> | |
<tr><td><?php echo(date('F j, Y ', $data[$i]['changedToAt']/1000).'at'.date(' g:i:s a', $data[$i]['changedToAt']/1000)); ?></td><td><code><?php echo(htmlspecialchars($data[$i]['name'])); ?></code></td></tr> | |
<?php | |
} | |
?> | |
</table> | |
<p>Thank you for not abusing this service.</p> | |
<?php | |
} | |
else | |
{ | |
?> | |
<p style="color: red;">Could not get name history.</p> | |
<?php | |
} | |
} | |
else | |
{ | |
?> | |
<p>This tool uses the <a href="http://wiki.vg/Mojang_API">Mojang API</a>.</p> | |
<p><a href="https://gist.github.com/LB--/b74baf9d75f9846e664b">Source code</a> available in public domain.</p> | |
<?php | |
} | |
?> | |
</body> | |
</html> |
This comment has been minimized.
This comment has been minimized.
GetSomeBlocks
commented
Feb 26, 2016
Can you help me to use this in my website? Im using get system and i want to show the Name history in the user profile; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
LB-- commentedMar 5, 2015