You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 52 guest(s) and 1 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - TeamSpeak Block [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Fook_Yu
Nuke Cadet
Nuke Cadet


Joined: Jul 27, 2004
Posts: 2


PostPosted: Wed Jul 28, 2004 4:23 pm Reply with quoteBack to top

The responce time is a bit low (dramaticly i would say). Here is the script;
Quote:
$counter++;
foreach ($playerList as $playerInfo)
{
if ($channelInfo[channelid] == $playerInfo[channelid])
{
$player_name = eregi_replace("\"", "", $playerInfo[playername]);
$content .= "<tr><td></td><td colspan=3><img src=\"images/bullet_0.gif\" border=\"0\" align=absmiddle>&nbsp;<b>" . $player_name . "</b></td></tr>\n";
}
}


and your quotes are gone.


oh and here is a link to a forum that is a bit more active;
http://phpnuke-uk.net/
Find all posts by Fook_YuView user's profileSend private message
MoG_Pontius
Nuke Soldier
Nuke Soldier


Joined: Aug 08, 2004
Posts: 21


PostPosted: Sat Aug 07, 2004 9:40 pm Reply with quoteBack to top

The information that MrMagoo put up works great! However, I too would like to watch only one channel (with subchannels) on a particular server. Is it possible with this code?

Code:
<?php

$usemarquee = 0;
$scrolldirection = "Up";

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

if (eregi("block-TS_HALO.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 .= "<table width=\"100%\">\n";
$counter = 0;
foreach($channelList as $channelInfo) {
   // default channel?
        if($channelInfo[isdefault] == 1) {
            $channelname = $channelInfo[channelname];
        } else {
            $channelname = $channelInfo[channelname];
        }

      if ($channelInfo[currentplayers] > 0) {
         $content .= "<tr><td><img src=\"images/teamspeak/bullet_channel.gif\" border=\"0\"></td><td colspan=1>".$channelname."</td></tr>";
      }

        $counter++;
foreach ($playerList as $playerInfo)
{
if ($channelInfo[channelid] == $playerInfo[channelid])
{
$player_name = eregi_replace("\"", "", $playerInfo[playername]);
$content .= "<tr><td></td><td colspan=3><img src=\"images/teamspeak/bullet_0.gif\" border=\"0\" align=absmiddle>&nbsp;" . $player_name . "</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 .= "</Marquee><br>";

?>
Find all posts by MoG_PontiusView user's profileSend private message
karmajay
Nuke Cadet
Nuke Cadet


Joined: Aug 21, 2004
Posts: 6


PostPosted: Thu Aug 26, 2004 7:50 am Reply with quoteBack to top

Thanks for the work!

Where do those bullets actually go? I have them in my webpost folder, yet they don't show up.

Also, I noticed that if there is a space in the name, the block only picks up the letters before the space. Is there someone to fix this?

Thanks!
Find all posts by karmajayView user's profileSend private message
karmajay
Nuke Cadet
Nuke Cadet


Joined: Aug 21, 2004
Posts: 6


PostPosted: Fri Aug 27, 2004 8:53 am Reply with quoteBack to top

I figured it out, just had to change the path for thos ebullets.

Thanks!
Find all posts by karmajayView user's profileSend private message
THEREDRUM
Nuke Cadet
Nuke Cadet


Joined: Sep 06, 2003
Posts: 1


PostPosted: Fri Aug 27, 2004 4:53 pm Reply with quoteBack to top

Thanks for the credit there Magoo U piece o chit!
}#{REDRUM Orginal "Un-Hacked" Teamspeak block creator.
Find all posts by THEREDRUMView user's profileSend private message
mrmagoo_83
Sergeant
Sergeant


Joined: Oct 03, 2003
Posts: 88


PostPosted: Fri Sep 10, 2004 11:54 am Reply with quoteBack to top

Hey I stated many times that I was not the creator of this block. I just tweaked some of it to fit my needs.

So don't go getting torked at me.

And on a second note, this wasn't the orginal code you sent me, I lost that code when my first site & teamspeak server went down. I then downloaded the code for the above block off another site, cause I tried to email you and see about getting it sent to me again. But heard nothing back, I liked yours cause it had the connect button, but since I never heard from you again, I went in search elsewhere. I found this code and edited it. That code had no Copyright name on it, like yours did, yours even had your website at the top I think.

So yes, you wrote a very nice TS block. But I didn't give credit cause I didn't use the block you gave me. So lose the attitude with me, cause I didn't do anything wrong.
Find all posts by mrmagoo_83View user's profileSend private message
CurtisTheGreat
Nuke Soldier
Nuke Soldier


Joined: Aug 09, 2004
Posts: 22


PostPosted: Fri Sep 17, 2004 2:42 pm Reply with quoteBack to top

Is there a way to make this script work with a Teamspeak server username and password? The server that I would be connecting to requires usernames and passwords to connect.

Any help would be great! Very Happy
Find all posts by CurtisTheGreatView user's profileSend private message
RobbieB
Lieutenant
Lieutenant


Joined: Jul 15, 2003
Posts: 195

Location: California

PostPosted: Sun Sep 19, 2004 8:58 pm Reply with quoteBack to top

How can I use this as just a standalone file? ie. non nuke site, plain page, just this.


I have 2 reasons for not wanting to use it as a block. I have a separate child site that the ts is really for and that site isn't on phpnuke. But also, I couldn't figure out how to change the indenting of the channel and user names. As it is now, the channel is indented or has more cell padding or margin then my regular blocks, and then the users in each channel themselves start in like the middle of the block so basically, anyone with more then 1 letter in their name pushes the block width way wider then the rest of my blocks.


Last edited by RobbieB on Mon Sep 20, 2004 10:25 am; edited 1 time in total
Find all posts by RobbieBView user's profileSend private messageVisit poster's website
CurtisTheGreat
Nuke Soldier
Nuke Soldier


Joined: Aug 09, 2004
Posts: 22


PostPosted: Mon Sep 20, 2004 4:53 am Reply with quoteBack to top

*bump*

Quote:
Is there a way to make this script work with a Teamspeak server username and password? The server that I would be connecting to requires usernames and passwords to connect.
Find all posts by CurtisTheGreatView user's profileSend private message
CurtisTheGreat
Nuke Soldier
Nuke Soldier


Joined: Aug 09, 2004
Posts: 22


PostPosted: Tue Sep 21, 2004 5:12 am Reply with quoteBack to top

No one has any ideas here? Confused
Find all posts by CurtisTheGreatView user's profileSend private message
Pagannn
Nuke Cadet
Nuke Cadet


Joined: Oct 12, 2004
Posts: 1


PostPosted: Tue Oct 12, 2004 4:27 pm Reply with quoteBack to top

Inspector wrote:
instead of using fscanf for separating the values or using next-functions you should use:

$line=fgets($socket);
$data=explode("\t",$line);


I fixed it. I'm sure it could have been done in a cleaner way, but I'm a php n00b as well.

This is a direct replacement of the do..while loop that contains the fscanf function (the line of code before the while loop begins MUST be included):

Code:

//Skip the first line. It only contains header labels
fgets($socket);
while (true)
{
   //Read the next line from the socket
   $line = fgets($socket);

   //Break it up on the tab delimiter
   $playerinfo = explode("\t", $line);

   //Bail out if only one element
   if (count($playerinfo) == 1)
   {
      //Only one element means the OK has been encountered.
      //The list is done.
      break;
   }
   
   //Stuff the array values into variables
   list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $d, $d, $totaltime, $idletime, $d, $d, $d, $s, $playername) = $playerinfo;
   
   $playerList[$playerid] = array("playerid" => $playerid,
               "channelid" => $channelid,
               "receivedpackets" => $receivedpackets,
               "receivedbytes" => $receivedbytes,
               "sentpackets" => $sentpackets,
               "sentbytes" => $sentbytes,
               "totaltime" => $totaltime,
               "idletime" => $idletime,
               "playername" => str_replace("\"", "", $playername));
}


This also removes the double quotes from the player name.
Find all posts by PagannnView user's profileSend private message
karmajay
Nuke Cadet
Nuke Cadet


Joined: Aug 21, 2004
Posts: 6


PostPosted: Wed Oct 13, 2004 2:45 pm Reply with quoteBack to top

Curtisthegreat,

I believe the block uses the admin name and password to get all the data.

It does work for channels where the users need passwords.
Find all posts by karmajayView user's profileSend private message
PresumedEvil
Nuke Cadet
Nuke Cadet


Joined: Jan 11, 2004
Posts: 5


PostPosted: Tue Nov 02, 2004 12:26 pm Reply with quoteBack to top

There's one that a couple of us worked up for CPG-Nuke at my site, and for DL in the cpgnuke forums as well.

www.presumedevil.com to see what it looks like. Needs no webpost at all, as it runs on a ported query tool.

Other questions can be directed to the www.cpgnuke.com forums on this, or on mine.

Twisted Evil
Find all posts by PresumedEvilView user's profileSend private message
JWP1987
Nuke Cadet
Nuke Cadet


Joined: Jan 06, 2005
Posts: 4


PostPosted: Thu Jan 06, 2005 11:30 am Reply with quoteBack to top

I've been coding a teamspeak block recently where you can get all the player, channel and server data by clicking on names.
Just been cleaning out the code and removing glitches like html tags being processed etc.

the TS block is running on http://www.btb-clan.f2s.com/index.php
it's at the bottom of the page in the middle.
it doesn't use webpost but it does use the database to output the channel and user data.

Tell me if anyone wants the code for it.
Find all posts by JWP1987View user's profileSend private message
D_R_A_G_O_N
Nuke Soldier
Nuke Soldier


Joined: Jan 02, 2005
Posts: 31

Location: harrisburg pa

PostPosted: Sat Jan 08, 2005 12:31 am Reply with quoteBack to top

this is not a block its a module that i ported

its still underconstruction but its 75% complete

check it out @

http://drg.d2g.com/PHP-Nuke-7.4/html/modules.php?name=TeamSpeak2

p.s it is not complete so if you like it please dont ask for it ...i will relese it when it is complete

later guys
D_R_A_G_O_N
Find all posts by D_R_A_G_O_NView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.378 Seconds - 192 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::