Guest User

Untitled

a guest
Mar 9th, 2017
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. <?php
  2.  
  3. /****************************************************************************************************************************/
  4.  
  5. //Change the following information to fit your needs
  6. date_default_timezone_set(''); //Set your timezone. You can find a list of supported timezones at http://php.net/manual/en/timezones.php
  7. $accountLoginName = ''; //Current login username/email for Mojang.com
  8. $accountUsername = ''; //Current in-game Minecraft username
  9. $accountPassword = ''; //Current account password
  10. $newName = ''; //Desired new username
  11. $time = ''; //Set the time that the account name should change. YYYY-MM-DD HH:MM:SS format. (Don't know the time of snipe? Check namemc.com)
  12. //DISABLE YOR SECURITY QUESTIONS BEFORE CONTINUING
  13.  
  14. /****************************************************************************************************************************/
  15.  
  16.  
  17. /*****************************************************PROGRAM START. DO NOT TOUCH*****************************************************/
  18.  
  19. set_time_limit(0);
  20. $accountUrl = 'https://account.mojang.com/login';
  21. $cookiePath = $_SERVER['DOCUMENT_ROOT'] . "/cookie.txt";
  22. $isItTime = false;
  23. $strToTime = strtotime($time);
  24.  
  25.  
  26. $uuid = file_get_contents('https://api.mojang.com/users/profiles/minecraft/' . $accountUsername);
  27. if (!empty($uuid)) {
  28. $uuid = explode(':', $uuid);
  29. $uuid = explode(',', $uuid[1]);
  30. $uuid = str_replace('"', '', $uuid[0]);
  31. }
  32. else {
  33. die("Invalid username");
  34. }
  35.  
  36. $fields = array(
  37. 'username' => $accountLoginName,
  38. 'password' => $accountPassword,
  39. 'remember' => 'true'
  40. );
  41. $fields_string = '';
  42. foreach($fields as $key => $value) {
  43. $fields_string .= $key . '=' . $value . '&';
  44. }
  45. rtrim($fields_string, '&');
  46.  
  47. $ch = curl_init($accountUrl);
  48. curl_setopt($ch, CURLOPT_POST, count($fields));
  49. curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
  50. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  51. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  52. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  53. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  54. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiePath);
  55. $result = curl_exec($ch);
  56.  
  57. if ($result == false) {
  58. die("Curl error: " . curl_error($ch));
  59. }
  60. else {
  61. curl_setopt($ch, CURLOPT_URL, 'https://account.mojang.com/me/renameProfile/' . $uuid);
  62. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
  63. $result2 = curl_exec($ch);
  64. if ($result2 == false) {
  65. die("Curl error: " . curl_error($ch));
  66. }
  67. else {
  68. $authToken = explode('name="authenticityToken" value="', $result2);
  69. $authToken = explode('">', $authToken[1]);
  70. $authToken = $authToken[0];
  71. $fields = array(
  72. 'newName' => $newName,
  73. 'password' => $accountPassword,
  74. 'authenticityToken' => $authToken);
  75. $fields_string = '';
  76. foreach($fields as $key => $value) {
  77. $fields_string .= $key . '=' . $value . '&';
  78. }
  79. rtrim($fields_string, '&');
  80. curl_setopt($ch, CURLOPT_POST, count($fields));
  81. curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
  82. while ($isItTime == false) {
  83.  
  84. if ($strToTime <= time()) {
  85. $result3 = curl_exec($ch);
  86. if (stripos($result3, 'errors') !== false || stripos($result3, 'error') !== false || stripos($result3, 'not found') !== false) {
  87. echo "An error occured:<br /><br />" . $result3;
  88. }
  89. else {
  90. echo "Username changed successfully.<br /><br />Old Username: " . $accountUsername . "<br />New username:" . $newName;
  91. }
  92. $isItTime = true;
  93. }
  94. else {
  95. continue;
  96. }
  97. }
  98. }
  99. }
  100.  
  101. curl_close($ch);
  102.  
  103. ?>
Add Comment
Please, Sign In to add comment