). $subchanimg = ""; //URL to Sub-Channel Image. $subchanchar = "·"; //Character to use instead if Image for Sub-Channels (eg; * or ->). $plrimg = "images/blocks/teamspeakblock/ball_g.gif"; //URL to Player Image. $plrchar = "->"; //Text Character to use instead of image (eg; * or ->). $subplrimg = "images/blocks/teamspeakblock/ball_r.gif"; //URL to Player Image in sub channel. $subplrchar = "--->"; //Text Character to use instead of image (eg; * or ->). $siteguest = "Site Guest"; // Define Desired name for users Loggin in from website. $srvpass = ""; // TS Server Connect Password $licenseURL1 = 'www.udesign.me.uk'; // URLs Allowed to use this code. Please do not $licenseURL2 = 'udesign.me.uk'; // distribute, copy or resell my code. Thanks. ########## RESERVED FOR FUTURE USE - DO NOT EDIT ########### $usemarquee = 0; //reserved for future use $scrolldirection = "Up"; //reserved for future use $userstatus = ""; //reserved for future use $isadmin = ""; //reserved for future use // **** end of settings **** ########################### END CUSTOM SETTINGS ################################# // opens a connection to the teamspeak server function getSocket($host, $port, $errno, $errstr, $timeout) { global $errno, $errstr; @$socket = fsockopen($host, $port, $errno, $errstr, $timeout); if($socket and fread($socket, 4) == "[TS]") { fgets($socket, 128); return $socket; }// end if return false; }// end function getSocket(...) // sends a query to the teamspeak server function sendQuery($socket, $query) { fputs($socket, $query."\n"); } // answer OK? function getOK($socket) { $result = fread($socket, 2); fgets($socket, 128); return($result == "OK"); } // closes the connection to the teamspeak server function closeSocket($socket) { fputs($socket, "quit"); fclose($socket); } // checks to make sure the server supports queries function checkportal(){ $srvstatus00="PGRpdiBhbGlnbj0iY2VudGVyIj48Zm9udCBmYWNlPSJBcmlhbCIgc2l6ZT0iMSI+IFRlYW1TcGVhayBCbG9jazxicj5ieSA8YSBocmVmPSJodHRwOi8vd3d3LnMzc3F1YWQuY29tIiB0YXJnZXQ9Il9uZXciPmp1Z2+rp7O7PC9hPjwvZm9udD48L2Rpdj4=";return("$srvstatus00"); } // retrieves the next argument in a tabulator-separated string (PHP scanf function bug workaround) function getNext($evalString) { $pos = strpos($evalString, "\t"); if(is_integer($pos)) { return substr($evalString, 0, $pos); } else { return $evalString; } } // removes the first argument in a tabulator-separated string (PHP scanf function bug workaround) function chopNext($evalString) { $pos = strpos($evalString, "\t"); if(is_integer($pos)) { return substr($evalString, $pos + 1); } else { return ""; } } // establish connection to teamspeak server $socket = getSocket($serverAddress, $serverQueryPort, $errno, $errstr, 3); if($socket == false) { $content .= "Sorry. I didn't quite get that right. Can you refresh the page?
\n"; $content .= "Error number: ".$errno."
\n"; $content .= "Error description: ".$errstr."
\n"; return; } // select the one and only running server on port 8767 sendQuery($socket, "sel ".$serverUDPPort); // retrieve answer "OK" if(!getOK($socket)) { // die("Server didn't answer "OK" after last command. Aborting."); $content .= "Server Is Down!\n"; return; }// end if // retrieve player list sendQuery($socket,"pl"); // read player info $playerList = array(); do { $playerinfo = ""; do { $plinput = fread($socket, 1); if($plinput != "\n" && $plinput != "\r") $playerinfo .= $plinput; } while($plinput != "\n"); $playerid = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $channelid = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $receivedpackets = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $receivedbytes = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $sentpackets = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $sentbytes = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $d = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $d = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $totaltime = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $idletime = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $d = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $d = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $d = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $d = getNext($playerinfo); $playerinfo = chopNext($playerinfo); $playername = getNext($playerinfo); if($playerid != "OK") { $playerList[$playerid] = array("playerid" => $playerid, "channelid" => $channelid, "receivedpackets" => $receivedpackets, "receivedbytes" => $receivedbytes, "sentpackets" => $sentpackets, "sentbytes" => $sentbytes, "totaltime" => $totaltime, "idletime" => $idletime, "playername" => $playername); } } while($playerid != "OK"); // retrieve channel list sendQuery($socket,"cl"); // read channel info $channelList = array(); do { $channelinfo = ""; do { $input = fread($socket, 1); if($input != "\n" && $input != "\r") $channelinfo .= $input; } while($input != "\n"); $channelid = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $codec = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $parent = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $d = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $maxplayers = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $channelname = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $d = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $password = getNext($channelinfo); $channelinfo = chopNext($channelinfo); $topic = getNext($channelinfo); if($parent == "-1") $isparent = 1; else $isparent = 0; if($channelid != "OK" && $isparent == 1) { if($isdefault == "Default") $isdefault = 1; else $isdefault = 0; if($password == "1") $password = 1; else $password = 0; // determine number of players in channel $playercount = 0; foreach($playerList as $playerInfo) { if($playerInfo[channelid] == $channelid) $playercount++; } $channelList[$channelid] = array("channelid" => $channelid, "codec" => $codec, "parent" => $parent, "maxplayers" => $maxplayers, "channelname" => $channelname, "isdefault" => $isdefault, "password" => $password, "topic" => $topic, "currentplayers" => $playercount); } } while($channelid != "OK"); // retrieve subchannel list sendQuery($socket,"cl"); // read subchannel info $subchannelList = array(); do { $subchannelinfo = ""; do { $subinput = fread($socket, 1); if($subinput != "\n" && $subinput != "\r") $subchannelinfo .= $subinput; } while($subinput != "\n"); $subchannelid = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $codec = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $subparent = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $d = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $maxplayers = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $subchannelname = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $d = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $password = getNext($subchannelinfo); $subchannelinfo = chopNext($subchannelinfo); $topic = getNext($subchannelinfo); if($subparent == "-1") $isparent = 1; else $isparent = 0; if($subchannelid != "OK" && $isparent == 0) { if($isdefault == "Default") $isdefault = 1; else $isdefault = 0; if($password == "1") $password = 1; else $password = 0; // determine number of players in subchannel $subplayercount = 0; foreach($playerList as $playerInfo) { if($playerInfo[channelid] == $subchannelid) $subplayercount++; } $subchannelList[$subchannelid] = array("channelid" => $subchannelid, "codec" => $codec, "parent" => $subparent, "maxplayers" => $maxplayers, "channelname" => $subchannelname, "isdefault" => $isdefault, "password" => $password, "topic" => $topic, "currentplayers" => $subplayercount); } } while($subchannelid != "OK"); $content .= ""; $content .= "
"; $content .= ""; $content .= "

"; $content .= ""; if ($showip == 1) { $content .= ""; } $content .= ""; $content .= ""; $content .= "
$squadname
".$serverAddress.":".$serverUDPPort."
Who's Online

"; $content .= "\n"; $counter = 0; if ($chanimg != "") { $chanimg = ""; } else { $chanimg = $chanchar; } if ($subchanimg != "") { $subchanimg = ""; } else { $subchanimg = $subchanchar; } if ($plrimg != "") { $plrimg = ""; } else { $plrimg = $plrchar; } if ($subplrimg != "") { $subplrimg = ""; } else { $subplrimg = $subplrchar; } // display channel list foreach($channelList as $channelInfo) { $channelname = $channelInfo[channelname]; if($channelInfo[password] == 1) { $channelname = "".$channelname.""; } $channelname=str_replace("\"","",$channelname); if ($channelname != "name") { if ($showallchan == 0) { if ($channelInfo[currentplayers] > 0) { $content .= ""; } }else{ $content .= ""; } $counter++; foreach ($playerList as $playerInfo) { $player = $playerInfo[playername]; $player = str_replace("\"","",$player); if ($channelInfo[channelid] == $playerInfo[channelid]) { $content .= "\n"; } } foreach($subchannelList as $subchannelInfo) { $subchannelname = $subchannelInfo[channelname]; if($subchannelInfo[password] == 1) { $subchannelname = "".$subchannelname.""; } $subchannelname=str_replace("\"","",$subchannelname); if ($channelInfo[channelid] == $subchannelInfo[parent]) { if ($channelname != "name" ) { if ($showallchan == 0) { if ($subchannelInfo[currentplayers] > 0) { $content .= ""; } }else{ $content .= ""; } $counter++; foreach ($playerList as $playerInfo) { $player = $playerInfo[playername]; $player = str_replace("\"","",$player); if ($subchannelInfo[channelid] == $playerInfo[channelid]) { $content .= "\n"; } } } } } } } if($counter == 0) { $content .= "\n"; } // close connection to teamspeak server closeSocket($socket); $content .= "
".$chanimg." ".$channelname."
".$chanimg." ".$channelname."
".$plrimg." ".$player."
".$subchanimg." ".$subchannelname."
".$subchanimg." ".$subchannelname."
".$subplrimg." ".$player."
No channels
\n"; $content .= "

\n"; if ($showlogin == 1) { $content .= "\n"; $content .= "\n"; $content .= "
\n"; $content .= "NickName
\n"; $content .= "
\n"; $content .= "Login (if assigned)
\n"; $content .= "
\n"; $content .= "Password
\n"; $content .= "
\n"; $content .= "