login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Overige scripts > Teamspeak Status

Teamspeak Status

Auteur: Boaz den Besten - 02 januari 2005 - 16:00 - Gekeurd door: Dennisvb - Hits: 9166 - Aantal punten: 4.00 (1 stem)




een handig script waarmee je kan zien wie er in een teamspeak server zitten.

Code:
  1. //tsfuncties.php\\
  2. <?
  3.  
  4. ###################################
  5. ## Gemaakt door: Boaz den Besten ##
  6. ## Gemaakt op: 07/09/2004 ##
  7. ###################################
  8.  
  9. //Player Status
  10. function pl_status($pl_status)
  11. {
  12. echo "<img src=\"image/ts/bullet_" . $pl_status . ".gif\">&nbsp;";
  13. }
  14.  
  15. //Player Flags
  16. function pl_flags($pl_flags,$ch_flags)
  17. {
  18. if($pl_flags == 13)
  19. {
  20. echo "R SA";
  21. }
  22. elseif($pl_flags == 5)
  23. {
  24. echo "R SA";
  25. }
  26. elseif($pl_flags == 4)
  27. {
  28. echo "R";
  29. }
  30. else
  31. {
  32. echo "U";
  33. }
  34.  
  35. if($ch_flags == 1)
  36. {
  37. echo "&nbsp;CA";
  38. }
  39. }
  40.  
  41. //Channel Flags
  42. function ch_flags($nr)
  43. {
  44. $ch_flags[0] = "&nbsp;(R)";
  45. $ch_flags[1] = "&nbsp;(U)";
  46. $ch_flags[2] = "&nbsp;(RM)";
  47. $ch_flags[3] = "&nbsp;(UM)";
  48. $ch_flags[4] = "&nbsp;(RP)";
  49. $ch_flags[5] = "&nbsp;(UP)";
  50. $ch_flags[6] = "&nbsp;(RMP)";
  51. $ch_flags[7] = "&nbsp;(UMP)";
  52. $ch_flags[8] = "&nbsp;(RS)";
  53. $ch_flags[9] = "&nbsp;(US)";
  54. $ch_flags[10] = "&nbsp;(RMS)";
  55. $ch_flags[11] = "&nbsp;(UMS)";
  56. $ch_flags[12] = "&nbsp;(RPS)";
  57. $ch_flags[13] = "&nbsp;(UPS)";
  58. $ch_flags[14] = "&nbsp;(RMPS)";
  59. $ch_flags[15] = "&nbsp;(UMPS)";
  60. $ch_flags[16] = "&nbsp;(RD)";
  61. $ch_flags[18] = "&nbsp;(RMD)";
  62. $ch_flags[20] = "&nbsp;(RPD)";
  63. $ch_flags[22] = "&nbsp;(RMPD)";
  64. $ch_flags[24] = "&nbsp;(RSD)";
  65. $ch_flags[26] = "&nbsp;(RMSD)";
  66. $ch_flags[28] = "&nbsp;(RPSD)";
  67. $ch_flags[30] = "&nbsp;(RMPSD)";
  68.  
  69. echo $ch_flags[$nr];
  70.  
  71. }
  72.  
  73. ?>

  1. //tsinfo.php\\
  2. <?
  3.  
  4. ###################################
  5. ## Gemaakt door: Boaz den Besten ##
  6. ## Gemaakt op: 09/09/2004 ##
  7. ## Versie: 1.2 ##
  8. ## Weizigingen sinds 1.1: ##
  9. ## * Kleine dingetjes verbeterd. ##
  10. ## Versie: 1.1 ##
  11. ## Wijzigingen sinds 1.0: ##
  12. ## * Functie pagina verbeterd. ##
  13. ## * Een klein foutje opgelost ##
  14. ## als de server leeg is. ##
  15. ###################################
  16.  
  17. //Variablen die nodig zijn voor de connectie...
  18. $ts['ip'] = "hier het ip van de server"; //Server IP
  19. $ts['queryport'] = 51234; //Query Port deze poort moet wel toegankelijk zijn via het internet, is die dat niet, dan kan je dit script niet gebruiken.
  20. $ts['port'] = "8767"; //Server Port
  21. $ts['name'] = "hier de naam van de server"; // Server name
  22.  
  23. ######################################
  24. ## HIER ONDER NIET MEER WIJZIGEN!!! ##
  25. ######################################
  26.  
  27. include("tsfuncties.php");
  28.  
  29. $chhashid = 0;
  30. $plhashid = 0;
  31. $subchhashid = 0;
  32.  
  33. //Connectie maken met de server...
  34. $cmd = "cl " . $ts['port'] . "\nquit\n";
  35. $connection = @fsockopen ($ts['ip'], $ts['queryport'], &$errno, &$errstr, 1);
  36. if (!$connection)
  37. {
  38. echo "Could not connect to the server.";
  39. }
  40. else
  41. {
  42. @fputs($connection,$cmd, strlen($cmd));
  43. while($channeldata = @fgets($connection, 4096))
  44. {
  45. $channeldata = explode(" ", $channeldata);
  46. if(isset($channeldata[5]) AND $channeldata[5] !== "name")
  47. {
  48.  
  49. if($channeldata[2] > -1)
  50. {
  51. //Sub-Channel hash maken...
  52. $subchhash[$subchhashid] = $channeldata[3] . ";" . $channeldata[5] . ";" . $channeldata[6] . ";" . $channeldata[0] . ";" . $channeldata[2];
  53. $subchhashid++;
  54. }
  55. else
  56. {
  57. //Channel hash maken...
  58. $chhash[$chhashid] = $channeldata[3] . ";" . $channeldata[5] . ";" . $channeldata[6] . ";" . $channeldata[0];
  59. $chhashid++;
  60. }
  61.  
  62. //Connectie maken met de server...
  63. $int_cmd = "pl " . $ts['port'] . "\nquit\n";
  64. $int_connection = @fsockopen ($ts['ip'], $ts['queryport'], &$errno, &$errstr, 1);
  65. if (!$int_connection)
  66. {
  67. echo "Could not connect to the server.";
  68. }
  69. else
  70. {
  71. @fputs($int_connection,$int_cmd, strlen($int_cmd));
  72. while($userdata = @fgets($int_connection, 4096))
  73. {
  74. $userdata = explode(" ", $userdata);
  75. if(isset($userdata[14]) AND $userdata[1] == $channeldata[0])
  76. {
  77. //Player hash maken...
  78. $plhash[$plhashid] = $userdata[11] . ";" . $userdata[10] . ";" . $userdata[14] . ";" . $userdata[12] . ";" . $userdata[1];
  79. $plhashid++;
  80. }
  81. }
  82. @fclose($int_connection);
  83. }
  84. }
  85. }
  86. @fclose($connection);
  87. }
  88.  
  89.  
  90. #############
  91. ## DISPLAY ##
  92. #############
  93.  
  94. if(isset($chhash))
  95. {
  96. rsort($chhash);
  97. sort($chhash,SORT_NUMERIC);
  98. }
  99.  
  100. if(isset($plhash))
  101. {
  102. sort($plhash);
  103. rsort($plhash,SORT_NUMERIC);
  104. }
  105.  
  106. if(isset($subchhash))
  107. {
  108. rsort($subchhash);
  109. sort($subchhash,SORT_NUMERIC);
  110. }
  111.  
  112. echo "<img src='image/ts/bullet_server.gif'>&nbsp;" . $ts['name'] . "<br>\n";
  113.  
  114. for($i=0;$i<$chhashid;$i++)
  115. {
  116. $chhashdata = explode(";", $chhash[$i]);
  117.  
  118. //Informatie echo'en...
  119. echo "<img src='image/ts/bullet_channel.gif'>&nbsp;" . trim($chhashdata[1], "\x22\x27");
  120. ch_flags($chhashdata[2]);
  121. echo "<br>\n";
  122.  
  123. //Sub-Channel Data
  124. for($sub_i=0;$sub_i<$subchhashid;$sub_i++)
  125. {
  126. $subchhashdata = explode(";", $subchhash[$sub_i]);
  127.  
  128. if($chhashdata[3] == $subchhashdata[4])
  129. {
  130. //Sub-Channel Informatie echo'en...
  131. echo "<img src='image/ts/bullet_subchannel.gif'>&nbsp;" . trim($subchhashdata[1], "\x22\x27");
  132. echo "<br>\n";
  133.  
  134. //Playerdata in subchannel...
  135. for($int_i=0;$int_i<$plhashid;$int_i++)
  136. {
  137. $plhashdata = explode(";", $plhash[$int_i]);
  138.  
  139. //Informatie echo'en...
  140. if($plhashdata[4] == $subchhashdata[3])
  141. {
  142. echo "&nbsp;&nbsp;&nbsp;&nbsp;";
  143. pl_status($plhashdata[3]);
  144. echo addslashes(htmlspecialchars(trim($plhashdata[2], "\x22\x27")));
  145. echo "&nbsp;(";
  146. pl_flags($plhashdata[0],$plhashdata[1]);
  147. echo ")";
  148. echo "<br>\n";
  149. }
  150. }
  151. }
  152. }
  153.  
  154. //Playerdata...
  155. for($int_i=0;$int_i<$plhashid;$int_i++)
  156. {
  157. $plhashdata = explode(";", $plhash[$int_i]);
  158.  
  159. //Informatie echo'en...
  160. if($plhashdata[4] == $chhashdata[3])
  161. {
  162. pl_status($plhashdata[3]);
  163. echo addslashes(htmlspecialchars(trim($plhashdata[2], "\x22\x27")));
  164. echo "&nbsp;(";
  165. pl_flags($plhashdata[0],$plhashdata[1]);
  166. echo ")";
  167. echo "<br>\n";
  168. }
  169. }
  170. }
  171.  
  172. ?>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (4)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.053s