SHARE
TWEET

wdasdwdwa

hallucinogenic Jun 27th, 2019 153 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?
  2. function GetStaffInfo($nodes)
  3. {
  4.     $stuff = multiple_threads_request($nodes);
  5.  
  6.     $json_decoded = multiple_threads_decodejson($stuff);
  7.  
  8.     $array_staff_temp2 = array();
  9.     $array_staff = array();
  10.    
  11.     foreach($json_decoded as $pack)
  12.     {
  13.         $json_decoded2 = json_decode($pack, true);
  14.         $SteamID =  $json_decoded2['response']['players'][0]['steamid'];
  15.         $name = $json_decoded2['response']['players'][0]['personaname'];
  16.         $avatar = $json_decoded2['response']['players'][0]['avatarfull'];
  17.         $profileurl = $json_decoded2['response']['players'][0]['profileurl'];
  18.         $state = $json_decoded2['response']['players'][0]['personastate'];
  19.  
  20.         switch($state)
  21.         {
  22.             //The user's current state, 1 - Online, 2 - Busy, 3 - Away, 4 - Snooze, 5 - looking to trade, 6 - looking to play
  23.             case 1: $ExtState = "Online"; break;
  24.             case 2: $ExtState = "Ocupado"; break;
  25.             case 3: $ExtState = "Ausente"; break;
  26.             case 4: $ExtState = "A Dormir"; break;
  27.             case 5: $ExtState = "À Procura de Troca"; break;
  28.             case 6: $ExtState = "À Procura de Jogo"; break;
  29.             default: $ExtState = "Offline"; break;
  30.         }
  31.  
  32.         $temp = array(
  33.             "steamid" => $SteamID,
  34.             "name" => $name,
  35.             "avatar" => $avatar,
  36.             "profileurl" => $profileurl,
  37.             "state" => $state,
  38.             "extstate" => $ExtState
  39.         );
  40.  
  41.         array_push($array_staff, $temp);
  42.     }
  43.  
  44.     return $array_staff;
  45. }
  46.  
  47. function multiple_threads_request($nodes){
  48.     $mh = curl_multi_init();
  49.     $curl_array = array();
  50.     foreach($nodes as $i => $url)
  51.     {
  52.         $curl_array[$i] = curl_init($url);
  53.         curl_setopt($curl_array[$i], CURLOPT_RETURNTRANSFER, true);
  54.         curl_multi_add_handle($mh, $curl_array[$i]);
  55.     }
  56.     $running = NULL;
  57.     do {
  58.         usleep(10000);
  59.         curl_multi_exec($mh,$running);
  60.     } while($running > 0);
  61.    
  62.     $res = array();
  63.     foreach($nodes as $i => $url)
  64.     {
  65.         $res[$url] = curl_multi_getcontent($curl_array[$i]);
  66.     }
  67.    
  68.     foreach($nodes as $i => $url){
  69.         curl_multi_remove_handle($mh, $curl_array[$i]);
  70.     }
  71.     curl_multi_close($mh);        
  72.     return $res;
  73. }
  74.  
  75. function multiple_threads_decodejson($json_object)
  76. {
  77.     $json_decoded = array();
  78.     foreach($json_object as $pack)
  79.     {
  80.         $temp = json_decode(json_encode($pack), true);
  81.         array_push($json_decoded, $temp);
  82.     }
  83.  
  84.     return $json_decoded;
  85. }
  86.  
  87. $array_staff_temp = array();
  88.  
  89.     $servername = "cp1.maskcloud.net";
  90.     $username = "hallucin_sm";
  91.     $password = "_5wek}{I1)dT";
  92.     $dbname = "hallucin_sm";
  93.  
  94.     $conn = mysqli_connect($servername, $username, $password, $dbname);
  95.     mysqli_set_charset($conn, 'utf8');
  96.  
  97.     $sql = "SELECT SteamID FROM sm_admins_groups WHERE group_id = 5;";
  98.     $result = $conn->query($sql);
  99.  
  100.     if($result->num_rows > 0)
  101.     {
  102.         while($row = $result->fetch_assoc())
  103.         {
  104.             array_push($array_staff_temp, "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=É_A_MINHA_API_E_NAO_QUERO_MOSTRAR&steamids=". getSteamID64($row['SteamID']));
  105.         }
  106.     }
  107.    
  108.     $array_admin = GetStaffInfo($array_staff_temp);
  109.    
  110.     $array_staff_temp = array();
  111.  
  112.     $sql = "SELECT SteamID FROM sm_admins_groups WHERE group_id = 7;";
  113.     $result = $conn->query($sql);
  114.  
  115.     if($result->num_rows > 0)
  116.     {
  117.         while($row = $result->fetch_assoc())
  118.         {
  119.             array_push($array_staff_temp, "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=É_A_MINHA_API_E_NAO_QUERO_MOSTRAR&steamids=". getSteamID64($row['SteamID']));
  120.         }
  121.     }
  122.  
  123.     $array_headadmin = GetStaffInfo($array_staff_temp);
  124.  
  125.     $array_staff_temp = array();
  126.  
  127.     $sql = "SELECT SteamID FROM sm_admins_groups WHERE group_id = 10;";
  128.     $result = $conn->query($sql);
  129.  
  130.     if($result->num_rows > 0)
  131.     {
  132.         while($row = $result->fetch_assoc())
  133.         {
  134.             array_push($array_staff_temp, "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=É_A_MINHA_API_E_NAO_QUERO_MOSTRAR&steamids=". getSteamID64($row['SteamID']));
  135.         }
  136.     }
  137.     $conn->close();
  138.  
  139.     $array_moderador = GetStaffInfo($array_staff_temp);
  140.  
  141.     $array_staff_temp = array();
  142.  
  143.     $url_temp = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=É_A_MINHA_API_E_NAO_QUERO_MOSTRAR&steamids=76561198013119117"; // Dono
  144.     array_push($array_staff_temp, $url_temp);
  145.     $url_temp = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=É_A_MINHA_API_E_NAO_QUERO_MOSTRAR&steamids=76561198261488636"; // Nunes
  146.     array_push($array_staff_temp, $url_temp);
  147.     $url_temp = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=É_A_MINHA_API_E_NAO_QUERO_MOSTRAR&steamids=76561198142832989"; // Pereira
  148.     array_push($array_staff_temp, $url_temp);
  149.  
  150.     $array_outros = GetStaffInfo($array_staff_temp);
  151.  
  152.     $array_staff = array(
  153.         "dono" => array($array_outros[0]),
  154.         "subdono" => array($array_outros[1], $array_outros[2]),
  155.         "headadmin" => $array_headadmin,
  156.         "admin" => $array_admin,
  157.         "moderador" => $array_moderador
  158.     );
  159. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top