Всем привет админ у меня к тебе есть вопрос как можно сделать такой скрипт? пытаюсь и нечего не получается
Вот скрипт
Код
...........................
// Main function (queries, sorts and displays the teamspeak serverinfo). Its code is not // very readable... well what shall I say about it... it was hard to write so it should // be hard to read > function displayTeamspeak($serverAddress, $serverUDPPort=8767, $serverQueryPort=51234) { $serverInfo = $this->queryTeamspeakServer($serverAddress, $serverUDPPort, $serverQueryPort);
print("<tr>\n<td class=\"alt1\">\n<table id=\"teamspeakdisplay\" name=\"teamspeakdisplay\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td>\n"); if ($serverInfo["queryerror"] != 0) { $popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): ""); if ($serverInfo["queryerror"] == 1) { $popupInfo .= ", Error: could not connect to query port"; } else { $popupInfo .= ", Error: no server running on port " . $serverUDPPort; } print("<table><tr><td>"); print("<img src=\"teamspeakdisplay/teamspeak_offline.png\" alt=\"\" title=\"" . $popupInfo . "\">"); print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">"); print("Server offline"); print("</td></tr></table>\n"); } else { $this->sortServerInfo($serverInfo);
// Generate javascript for teamspeak hyperlinks $jsTeamspeakId = str_replace(".", "_", $serverAddress) . "_" . $serverUDPPort; print("<script type=\"text/javascript\">\n<!--\n"); print("function enterServer_" . $jsTeamspeakId . "() {\n"); print(" enterSubChannel_" . $jsTeamspeakId . "(null, false, null);\n"); print("}\n"); print("function enterChannel_" . $jsTeamspeakId . "(channelName, channelPassworded) {\n"); print(" enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, null);\n"); print("}\n"); print("function enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, subChannelName) {\n"); print(" var serveraddress = 'teamspeak://" . $serverAddress . ":" . $serverUDPPort . "';\n"); print(" var nickname=window.prompt('Enter your nickname');\n"); print(" if (nickname == null) {\n"); print(" return;\n"); print(" } else if (nickname == \"\") {\n"); print(" window.alert('Could not enter the teamspeak server because you did not enter your nickname');\n"); print(" return;\n"); print(" }\n"); print(" serveraddress = serveraddress + \"/nickname=\" + nickname;\n"); if ($serverInfo["serverinfo"]["server_password"] == "1") { print(" var password=window.prompt('Enter the teamspeak server password for " . $serverInfo["serverinfo"]["server_name"] . "');\n"); print(" if (password == null) {\n"); print(" return;\n"); print(" } else if (password == \"\") {\n"); print(" window.alert('Could not enter the teamspeak server because you did not enter a server password');\n"); print(" return;\n"); print(" }\n"); print(" serveraddress = serveraddress + \"?password=\" + password;\n"); } print(" if (channelName != null) { serveraddress = serveraddress + \"?channel=\" + channelName; }\n"); print(" if (channelPassworded) {\n"); print(" var channelpassword=window.prompt('Enter the channel password for channel ' + channelName);\n"); print(" if (channelpassword == null) {\n"); print(" return;\n"); print(" } else if (channelpassword == \"\") {\n"); print(" window.alert('Could not enter the teamspeak server because you did not enter a channel password');\n"); print(" return;\n"); print(" }\n"); print(" serveraddress = serveraddress + \"?channelpassword=\" + channelpassword;\n"); print(" }\n"); print(" if (subChannelName != null) { serveraddress = serveraddress + \"?subchannel=\" + subChannelName; }\n"); print(" window.location=serveraddress;\n"); print("}\n"); print("//--></script>\n");
// Print the topmost element of the teamspeak tree print("<table><tr><td>"); print("<img src=\"teamspeakdisplay/teamspeak_online.png\" alt=\"\" title=\"" . $popupInfo . "\">"); print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">"); print("<a class=\"teamspeakserver\" href=\"javascript:enterServer_" . $jsTeamspeakId . "();\">"); print(str_replace(" ", " ", htmlspecialchars($serverInfo["serverinfo"]["server_name"]))); print("</a>"); print("</td></tr></table>\n");
// Count the number of channels to be listed: $currentchannels = 0; foreach($serverInfo["channellist"] as $channelInfo) { if ($channelInfo["parent"] == -1) { $currentchannels++; } }
// Initialize the channelcounter to zero $counter = 0;
// Loop through all channels: foreach($serverInfo["channellist"] as $channelInfo) { if ($channelInfo["parent"] == -1) {
// determine number of players in channel $currentplayers = 0; foreach($serverInfo["playerlist"] as $playerInfo) { if($playerInfo[channelid] == $channelInfo["channelid"]) $currentplayers++; }
// Count the number of channels to be listed: $currentplayersandsubchannels = $currentplayers; foreach($serverInfo["channellist"] as $subchannelInfo) { if ($subchannelInfo["parent"] == $channelInfo["channelid"]) { $currentplayersandsubchannels++; } }
// Increase the player counter: $counter_playerandsubchannels++; } }
// Loop through all channels: foreach($serverInfo["channellist"] as $subchannelInfo) { if ($subchannelInfo["parent"] == $channelInfo["channelid"]) { // determine number of players in channel $currentplayers = 0; foreach($serverInfo["playerlist"] as $playerInfo) { if($playerInfo[channelid] == $subchannelInfo["channelid"]) $currentplayers++; }