Advertisement
Guest User

Untitled

a guest
May 1st, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.90 KB | None | 0 0
  1. <?php
  2.  
  3. // Input
  4. $group_id         = $_GET['groupId'];
  5. $new_role_set_id  = $_GET['newRoleSetId'];
  6. $target_user_id   = $_GET['targetUserId'];
  7.  
  8. // Login User Data
  9. $login_user       = 'username=USERNAME&password=PASSWORD';
  10. $file_path_rs     = 'rs.txt';
  11. $file_path_token  = 'token.txt';
  12. $current_rs       = file_get_contents($file_path_rs);
  13. $current_token    = file_get_contents($file_path_token);
  14.  
  15. // [Function] Get ROBLOSECRUITY
  16. function getRS()
  17. {
  18.     global $login_user, $file_path_rs;
  19.     $get_cookies = curl_init('https://www.roblox.com/newlogin');
  20.     curl_setopt_array($get_cookies,
  21.         array(
  22.             CURLOPT_RETURNTRANSFER => true,
  23.             CURLOPT_HEADER => true,
  24.             CURLOPT_POST => true,
  25.             CURLOPT_POSTFIELDS => $login_user
  26.                         //CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6",
  27.                         //CURLOPT_FOLLOWLOCATION => true,
  28.                         //CURLOPT_REFERER => "http://www.roblox.com"
  29.         )
  30.     );
  31.     $rs = (preg_match('/(\.ROBLOSECURITY=.*?);/', curl_exec($get_cookies), $matches) ? $matches[1] : '');
  32.     file_put_contents($file_path_rs, $rs, true);
  33.     curl_close($get_cookies);
  34.     return $rs;
  35. }
  36.  
  37.  
  38.  
  39. // [Function] Change User's Group Rank
  40. function changeRank($rs, $token)
  41. {
  42.         global $group_id, $new_role_set_id, $target_user_id, $file_path_token;
  43.        
  44.         $promote_user = curl_init("http://www.roblox.com/groups/api/change-member-rank?groupId=$group_id&newRoleSetId=$new_role_set_id&targetUserId=$target_user_id");
  45.         curl_setopt_array($promote_user,
  46.                 array(
  47.                         CURLOPT_RETURNTRANSFER => true,
  48.                         CURLOPT_POST => true,
  49.                         CURLOPT_HEADER => true,
  50.                         CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token", "Content-Type: application/x-www-form-urlencoded; charset=UTF-8"),
  51.                 )
  52.         );
  53.  
  54.         $resp = curl_exec($promote_user);
  55.         $resp_header_size = curl_getinfo($promote_user, CURLINFO_HEADER_SIZE);
  56.         $resp_header = substr($resp, 0, $resp_header_size);
  57.         $resp_body = substr($resp, $resp_header_size);
  58.  
  59.         if (preg_match('/GuestData/', $resp_header)) {
  60.                 // RS invalid
  61.                 $resp_body = changeRank( getRS(), $token );
  62.         } else if (preg_match('/Token Validation Failed/', $resp_header)) {
  63.                 // Token invalid
  64.                 $new_token = (preg_match('/X-CSRF-TOKEN: (\S+)/', $resp_header, $matches) ? $matches[1] : '');
  65.                 file_put_contents($file_path_token, $new_token, true);
  66.                 $resp_body = changeRank( $rs, $new_token );
  67.         }
  68.  
  69.         curl_close($promote_user);
  70.  
  71.         return $resp_body;
  72. }
  73.  
  74. // Change user's group rank and echo results
  75. echo changeRank($current_rs, $current_token);
  76. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement