Advertisement
Guest User

changeRank.php

a guest
Jan 11th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. <?php
  2. $group_id = $_GET['85734'];
  3. $new_role_set_id = $_GET['newRoleSetId'];
  4. $target_user_id = $_GET['targetUserId'];
  5.  
  6.  
  7. $login_user = 'username=TarkBot&password=######';
  8. $file_path_rs = 'rs.txt';
  9. $file_path_token = 'token.txt';
  10. $current_rs = file_get_contents($file_path_rs);
  11. $current_token = file_get_contents($file_path_token);
  12.  
  13.  
  14. function getRS()
  15. {
  16. global $login_user, $file_path_rs;
  17.  
  18. $get_cookies = curl_init('https://www.roblox.com/newlogin');
  19.  
  20. curl_setopt_array($ch, CURLOPT_POSTFIELDS, $get_cookies,
  21. array(
  22. CURLOPT_RETURNTRANSFER => true,
  23. CURLOPT_HEADER => true,
  24. CURLOPT_POST => true,
  25.  
  26. // CURLOPT_HTTPHEADER => array("Content-Length: " . strlen($login_user)),
  27.  
  28. CURLOPT_POSTFIELDS => $login_user
  29.  
  30. )
  31. );
  32.  
  33. $rs = (preg_match('/(\.ROBLOSECURITY=.*?);/', curl_exec($get_cookies), $matches) ? $matches[1] : '');
  34. file_put_contents($file_path_rs, $rs, true);
  35. curl_close($get_cookies);
  36.  
  37. return $rs;
  38. }
  39.  
  40.  
  41. function changeRank($rs, $token)
  42. {
  43. global $group_id, $new_role_set_id, $target_user_id, $file_path_token;
  44.  
  45. $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");
  46. curl_setopt_array($promote_user,
  47. array(
  48. CURLOPT_RETURNTRANSFER => true,
  49. CURLOPT_POST => true,
  50. CURLOPT_HEADER => true,
  51. CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token")
  52. )
  53. );
  54.  
  55. $resp = curl_exec($promote_user);
  56. $resp_header_size = curl_getinfo($promote_user, CURLINFO_HEADER_SIZE);
  57. $resp_header = substr($resp, 0, $resp_header_size);
  58. $resp_body = substr($resp, $resp_header_size);
  59.  
  60. if (preg_match('/GuestData/', $resp_header)) {
  61.  
  62. $resp_body = changeRank( getRS(), $token );
  63. } else if (preg_match('/Token Validation Failed/', $resp_header)) {
  64.  
  65. $new_token = (preg_match('/X-CSRF-TOKEN: (\S+)/', $resp_header, $matches) ? $matches[1] : '');
  66. file_put_contents($file_path_token, $new_token, true);
  67. $resp_body = changeRank( $rs, $new_token );
  68. }
  69.  
  70. curl_close($promote_user);
  71.  
  72. return $resp_body;
  73. }
  74.  
  75.  
  76. echo changeRank($current_rs, $current_token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement