Guest User

Untitled

a guest
Feb 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <?
  2.  
  3. $serverstatus = array(
  4.  
  5. function source_query($ip){
  6. $cut = explode(":", $ip);
  7. $HL2_address = $cut[0];
  8. $HL2_port = $cut[1];
  9.  
  10. $HL2_command = "\377\377\377\377TSource Engine Query\0";
  11.  
  12. $HL2_socket = fsockopen("udp://".$HL2_address, $HL2_port, $errno, $errstr,3);
  13. fwrite($HL2_socket, $HL2_command);
  14. $JunkHead = fread($HL2_socket,4);
  15. $CheckStatus = socket_get_status($HL2_socket);
  16.  
  17. if($CheckStatus["unread_bytes"] == 0)return 0;
  18.  
  19. $do = 1;
  20. while($do){
  21. $str = fread($HL2_socket,1);
  22. $HL2_stats.= $str;
  23. $status = socket_get_status($HL2_socket);
  24. if($status["unread_bytes"] == 0){
  25. $do = 0;
  26. }
  27. }
  28. fclose($HL2_socket);
  29.  
  30. $x = 0;
  31. while ($x <= strlen($HL2_stats)){
  32. $x++;
  33. $result.= substr($HL2_stats, $x, 1);
  34. }
  35.  
  36. // ord ( string $string );
  37. $result = str_split($result);
  38. $info['network'] = ord($result[0]);$char = 1;
  39. while(ord($result[$char]) != "%00"){$info['name'] .= $result[$char];$char++;}$char++;
  40. while(ord($result[$char]) != "%00"){$info['map'] .= $result[$char];$char++;}$char++;
  41. while(ord($result[$char]) != "%00"){$info['dir'] .= $result[$char];$char++;}$char++;
  42. while(ord($result[$char]) != "%00"){$info['description'] .= $result[$char];$char++;}$char++;
  43. $info['appid'] = ord($result[$char].$result[($char+1)]);$char += 2;
  44. $info['players'] = ord($result[$char]);$char++;
  45. $info['max'] = ord($result[$char]);$char++;
  46. $info['bots'] = ord($result[$char]);$char++;
  47. $info['dedicated'] = ord($result[$char]);$char++;
  48. $info['os'] = chr(ord($result[$char]));$char++;
  49. $info['password'] = ord($result[$char]);$char++;
  50. $info['secure'] = ord($result[$char]);$char++;
  51. while(ord($result[$char]) != "%00"){$info['version'] .= $result[$char];$char++;}
  52.  
  53. return $info;
  54. }
  55. $q = source_query('81.19.217.223:28670');
  56.  
  57. echo '<a href="steam://connect/81.19.217.223:28670" style="text-decoration:none"><b><FONT COLOR="orange">HL2RP:&nbsp;&nbsp;</FONT></b>';
  58. echo '<b><FONT COLOR="lightgreen">81.19.217.223:28670</FONT></b>';
  59. echo '&nbsp;&nbsp;<b><FONT COLOR="##6699DD">'.$q['players'].'</FONT></b>/';
  60. echo '<b><FONT COLOR="red">'.$q['max'].'</FONT></b></a>';
  61.  
  62. $my_server_status = $serverstatus
  63. ?>
Add Comment
Please, Sign In to add comment