Display Error with Teamspeak Block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   re: Display Error with Teamspeak Block
R2Mrs
CZ Newbie
 Codezwiz Site Donator
R2Mrs has been a member for over 19 year's 19 Year Member
australia.gif
Age: 50
Gender: Female
Website:
Status: Offline
Joined: Sep 25, 2005
0.00 posts per day
Posts: 28
Points: 1,200
  MSN Messenger 
Will do Staffie, working on it today. Thanks to You and Kelly for all your help. icon_mrgreen.gif



Back to top Reply with quote
#2   re: Display Error with Teamspeak Block
R2Mrs
CZ Newbie
 Codezwiz Site Donator
R2Mrs has been a member for over 19 year's 19 Year Member
australia.gif
Age: 50
Gender: Female
Website:
Status: Offline
Joined: Sep 25, 2005
0.00 posts per day
Posts: 28
Points: 1,200
  MSN Messenger 
Howdy guys, Ive managed to install the webpost ok but when I link to the block file it displays like this

[ Register or login to view links on this board.]

Im presuming its displaying like this because of the block code but Im not sure.Its seems to be too wide again and I cant see any of the channels ect.



Back to top Reply with quote
#3   
Staffie
CZ Revered Member
 Codezwiz Site Donator
uk.gif
Occupation: Investigation Officer
Age: 40
Gender: Male
Website:
Status: Offline
Joined: May 27, 2003
0.18 posts per day
Posts: 1454
Points: 401,085
   
hmmm ok, its too wide cos of the image at the bottom, unsure why it is not displaying the channels tho. Post the file and will take a look at it.




_________________
Back to top Reply with quote
#4   re: Display Error with Teamspeak Block
R2Mrs
CZ Newbie
 Codezwiz Site Donator
R2Mrs has been a member for over 19 year's 19 Year Member
australia.gif
Age: 50
Gender: Female
Website:
Status: Offline
Joined: Sep 25, 2005
0.00 posts per day
Posts: 28
Points: 1,200
  MSN Messenger 
Thats the block file

<?php

$usemarquee = 1;
$scrolldirection = "Up";

// **** settings - to be edited before first use ****
$serverAddress = "216.151.149.118";  // can be ip address or url
$serverQueryPort = 8526;  // default 51234, must be accessible and usable. check server.ini
$serverUDPPort = 8526;  // default 8767
// **** end of settings ****

if (eregi("block-Teamspeak.php", $PHP_SELF)) {
  Header("Location: index.php");
  die();
}

global $user, $cookie;
getusrinfo($user);
cookiedecode($user);
$username = $cookie[1];

// 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);
}

// 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 "";
        }
}

// MAIN PROGRAM START

// establish connection to teamspeak server
$socket = getSocket($serverAddress, $serverQueryPort, $errno, $errstr, 3);
if($socket == false) {
        $content .= "An error connecting to the TeamSpeak server has occured!<br>\n";
        $content .= "Error number: ".$errno."<br>\n";
        $content .= "Error description: ".$errstr."<br>\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 &quot;OK&quot; after last command. Aborting.");
}// end if

// retrieve player list
sendQuery($socket,"pl");

// read player info
$playerList = array();
do {
   $playerinfo = fscanf($socket, "%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s");
        list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $d, $d, $totaltime, $idletime, $d, $d, $d, $s, $playername) = $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);
        $d = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $topic = getNext($channelinfo);

        if($channelid != "OK") {
      if($isdefault == "Default") $isdefault = 1; else $isdefault = 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,
                                             "topic" => $topic,
                                             "currentplayers" => $playercount);
   }
} while($channelid != "OK");

// display channel list
$content .= "<center><a href=webpost/login.php?detail=4&channel=RagingRebels target=\"_blank\"><font color=#000000 size=+3><B>->CONNECT<-</B></font></center></a><br>";
$content .= "<table width=\"100%\">\n";
$counter = 0;
foreach($channelList as $channelInfo) {
   // default channel?
        if($channelInfo[isdefault] == 1) {
            $channelname = $channelInfo[channelname];
        }

        if ($channelname == "The Lobby") {
          $content .= "<tr><td><img src=\"images/bullet_channel.gif\" border=\"0\"></td><td colspan=2>".$channelname."</td></tr>\n";
        }

        $counter++;
        foreach ($playerList as $playerInfo) {
           if ($channelInfo[channelid] == $playerInfo[channelid]) {
              $content .= "<tr><td></td><td colspan=3><img src=\"images/bullet_0.gif\" border=\"0\" align=absmiddle>&nbsp;".$playerInfo[playername]."</td></tr>\n";
           }
        }
    }

    if($counter == 0) $content .= "<tr><td colspan=\"4\" align=\"CENTER\">No channels</td></tr>\n";
    $content .= "</table>\n";

    // close connection to teamspeak server
    closeSocket($socket);

$content .= "<br><center><a href=http://www.teamspeak.org/modules.php?op=modload&name=Downloads&file=index><img src=http://www.teamspeak.org/images/ngz.gif border=\"0\" alt=\"Download TeamSpeak\"></a></center>";

?>



Back to top Reply with quote
#5   
Staffie
CZ Revered Member
 Codezwiz Site Donator
uk.gif
Occupation: Investigation Officer
Age: 40
Gender: Male
Website:
Status: Offline
Joined: May 27, 2003
0.18 posts per day
Posts: 1454
Points: 401,085
   
The server query port is another port entirely different from the port you have placed in there. You need to speak to the owners of the server with reference to the correct port number which is in the server.ini file.




_________________
Back to top Reply with quote
#6   re: Display Error with Teamspeak Block
R2Mrs
CZ Newbie
 Codezwiz Site Donator
R2Mrs has been a member for over 19 year's 19 Year Member
australia.gif
Age: 50
Gender: Female
Website:
Status: Offline
Joined: Sep 25, 2005
0.00 posts per day
Posts: 28
Points: 1,200
  MSN Messenger 
Ive had a confirmation from the server host that that is the query port they have tested it and it is open..Where to now buddy icon_biggrin.gif

PS Staffie I got multiple timezone clocks up and running thanks for the help there too icon_wink.gif



Back to top Reply with quote
#7   
Staffie
CZ Revered Member
 Codezwiz Site Donator
uk.gif
Occupation: Investigation Officer
Age: 40
Gender: Male
Website:
Status: Offline
Joined: May 27, 2003
0.18 posts per day
Posts: 1454
Points: 401,085
   
hmmm ok im gonna have to get some help on this one, TELLIIIIIIIIIIIIIIIIIIIIIIIIIIIII we need you!




_________________
Back to top Reply with quote
#8   re: Display Error with Teamspeak Block
R2Mrs
CZ Newbie
 Codezwiz Site Donator
R2Mrs has been a member for over 19 year's 19 Year Member
australia.gif
Age: 50
Gender: Female
Website:
Status: Offline
Joined: Sep 25, 2005
0.00 posts per day
Posts: 28
Points: 1,200
  MSN Messenger 
Any word yet Staffie, still havent been able to get it working icon_sad.gif



Back to top Reply with quote
#9   
Staffie
CZ Revered Member
 Codezwiz Site Donator
uk.gif
Occupation: Investigation Officer
Age: 40
Gender: Male
Website:
Status: Offline
Joined: May 27, 2003
0.18 posts per day
Posts: 1454
Points: 401,085
   
na, im still lookin around for an answer.




_________________
Back to top Reply with quote
#10   re: Display Error with Teamspeak Block
R2Mrs
CZ Newbie
 Codezwiz Site Donator
R2Mrs has been a member for over 19 year's 19 Year Member
australia.gif
Age: 50
Gender: Female
Website:
Status: Offline
Joined: Sep 25, 2005
0.00 posts per day
Posts: 28
Points: 1,200
  MSN Messenger 
Thanks bud icon_biggrin.gif



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum