Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2. function getvalue($uid, $what)
  3. {
  4.     $ip = "95.211.124.135";
  5.     $port = 20103;
  6.     $rcon = "xxxx";
  7.     $server = fsockopen("udp://" . $ip, $port, $errno, $errstr, 1);
  8.     stream_set_timeout($server, 0, 200000);
  9.     fwrite($server, "\xFF\xFF\xFF\xFFrcon ".$rcon." status");
  10.     $return = stream_get_contents($server);
  11.     fclose($server);
  12.    
  13.     $status = str_replace("\xFF\xFF\xFF\xFFprint\n","",$return);
  14.    
  15.     $status = trim($status);
  16.    
  17.     $saved_status = $status;
  18.    
  19.    
  20.     $saved_explode = explode("\n",$status);
  21.    
  22.     unset($saved_explode[0]);
  23.     unset($saved_explode[1]);
  24.     unset($saved_explode[2]);
  25.    
  26.     $status = ereg_replace(" +"," ",$status);
  27.     $explode = explode("\n",$status);
  28.    
  29.     unset($explode[0]);
  30.     unset($explode[1]);
  31.     unset($explode[2]);
  32.    
  33.     $end_return = 'User not found.';
  34.    
  35.     foreach ($explode as $key => $value) {
  36.    
  37.         $fp = "No";
  38.         $guid = "n/a";
  39.         $fpban = "";
  40.    
  41.         $spliff = explode(" ",$value);
  42.    
  43.         $id = $spliff[1];
  44.         $score = $spliff[2];
  45.         $ping = $spliff[3];
  46.    
  47.         $rate = $spliff[count($spliff)-1];
  48.         $qport = $spliff[count($spliff)-2];
  49.    
  50.         $address_temp = $spliff[count($spliff)-3];
  51.    
  52.         $address = substr($address_temp,0,strpos($address_temp,":"));
  53.         $gameport = substr($address_temp,strpos($address_temp,":")+1);
  54.    
  55.         $lastmsg = $spliff[count($spliff)-4];
  56.    
  57.         $pos = strpos($saved_explode[$key]," $ping ") + strlen(" $ping ");
  58.         $lastpos = strrpos($saved_explode[$key]," $lastmsg ");
  59.    
  60.         $name = str_replace("'","",str_replace("#","",htmlentities(trim(substr($saved_explode[$key]," $pos ",$lastpos - $pos)))));
  61.    
  62.         if ($uid == $id) {
  63.             if ($what == "name") $end_return = $name;
  64.             if ($what == "address") $end_return = $address;
  65.         }
  66.     }
  67.     return $end_return;
  68. }
  69.  
  70. echo getvalue($_GET['id'], $_GET['what']);
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement