Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /****************************************************************************************************************************/
- //Change the following information to fit your needs
- date_default_timezone_set(''); //Set your timezone. You can find a list of supported timezones at http://php.net/manual/en/timezones.php
- $accountLoginName = ''; //Current login username/email for Mojang.com
- $accountUsername = ''; //Current in-game Minecraft username
- $accountPassword = ''; //Current account password
- $newName = ''; //Desired new username
- $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)
- //DISABLE YOR SECURITY QUESTIONS BEFORE CONTINUING
- /****************************************************************************************************************************/
- /*****************************************************PROGRAM START. DO NOT TOUCH*****************************************************/
- set_time_limit(0);
- $accountUrl = 'https://account.mojang.com/login';
- $cookiePath = $_SERVER['DOCUMENT_ROOT'] . "/cookie.txt";
- $isItTime = false;
- $strToTime = strtotime($time);
- $uuid = file_get_contents('https://api.mojang.com/users/profiles/minecraft/' . $accountUsername);
- if (!empty($uuid)) {
- $uuid = explode(':', $uuid);
- $uuid = explode(',', $uuid[1]);
- $uuid = str_replace('"', '', $uuid[0]);
- }
- else {
- die("Invalid username");
- }
- $fields = array(
- 'username' => $accountLoginName,
- 'password' => $accountPassword,
- 'remember' => 'true'
- );
- $fields_string = '';
- foreach($fields as $key => $value) {
- $fields_string .= $key . '=' . $value . '&';
- }
- rtrim($fields_string, '&');
- $ch = curl_init($accountUrl);
- curl_setopt($ch, CURLOPT_POST, count($fields));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiePath);
- $result = curl_exec($ch);
- if ($result == false) {
- die("Curl error: " . curl_error($ch));
- }
- else {
- curl_setopt($ch, CURLOPT_URL, 'https://account.mojang.com/me/renameProfile/' . $uuid);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
- $result2 = curl_exec($ch);
- if ($result2 == false) {
- die("Curl error: " . curl_error($ch));
- }
- else {
- $authToken = explode('name="authenticityToken" value="', $result2);
- $authToken = explode('">', $authToken[1]);
- $authToken = $authToken[0];
- $fields = array(
- 'newName' => $newName,
- 'password' => $accountPassword,
- 'authenticityToken' => $authToken);
- $fields_string = '';
- foreach($fields as $key => $value) {
- $fields_string .= $key . '=' . $value . '&';
- }
- rtrim($fields_string, '&');
- curl_setopt($ch, CURLOPT_POST, count($fields));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
- while ($isItTime == false) {
- if ($strToTime <= time()) {
- $result3 = curl_exec($ch);
- if (stripos($result3, 'errors') !== false || stripos($result3, 'error') !== false || stripos($result3, 'not found') !== false) {
- echo "An error occured:<br /><br />" . $result3;
- }
- else {
- echo "Username changed successfully.<br /><br />Old Username: " . $accountUsername . "<br />New username:" . $newName;
- }
- $isItTime = true;
- }
- else {
- continue;
- }
- }
- }
- }
- curl_close($ch);
- ?>
Add Comment
Please, Sign In to add comment