DeathToMe asked if anyone figured out how to post two teamspeak server blocks. I have been able to modify the code to allow a single block to show the status of two servers including individual log in's. Here is the code.
Code:
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com) */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/************************************************************************/
/* block-Teamspeak_dual.php */
/* =========================== */
/* */
/* Copyright (c) 2004 by jaj (jaj@nukecops.com) */
/* http://nukecops.com */
/************************************************************************/
/* Cosmetic changes by CaptDD at webmaster@rapidfireclan.com
/* Changed to Show 2 Servers With Logins for each */
/* http://rapidfireclan.com */
/************************************************************************/
// **** settings - to be edited before first use ****
$serverAddress = "xxx.xxx.xxx.xxx"; // can be ip address or url
$serverQueryPort = 51234; // default 51234, must be accessible and usable. check server.ini
$serverUDPPort = 8767; // default 8767
$serverAddress1 = "xxx.xxx.xxx.xxx"; // can be ip address or url
$serverQueryPort1 = 51234; // default 51234, must be accessible and usable. check server.ini
$serverUDPPort1 = 8768; // default 8767
// **** end of settings ****
if (eregi("block-Teamspeak3.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");
}
// determine number of players in channel
$playercount = 0;
foreach($playerList as $playerInfo) {
if($playerInfo[channelid] == $channelid) $playercount++;
}
// determine number of players in channel
$playercount = 0;
foreach($playerList as $playerInfo) {
if($playerInfo[channelid] == $channelid) $playercount++;
}
I found an error in the code made available from JWP1987. I was having problems with his block not posting data to the database. Below are the two lines of corrected code.
Line 141
The block still does not work correctly but is closer. It now shows the channel and user information. However it only shows the correct number of channels and users. It does not show the channel names, user names or correct permissions.
If someone else can help to get the rest of the code corrected it would be much appreciated.
Last edited by Krusher on Sat Mar 05, 2005 6:10 pm; edited 2 times in total
Krusher Nuke Cadet
Joined: Mar 05, 2005
Posts: 3
Posted:
Sat Mar 05, 2005 5:34 pm
There it is - Two guarenteed working servers in one block -- Yes it is an edit - Check it out at http://www.us-tactical.com.. If anyone would like the block - e-mail me at pmore66@us-tactical.com ..
Krusher Nuke Cadet
Joined: Mar 05, 2005
Posts: 3
Posted:
Sun Mar 06, 2005 11:42 am
I forgot to add that by adding servers to the block, make sure the very first server is the one that goes down the least - Reason is that if the primary server goes down, the other servers on the block goes down - So far i've been sucessfull in adding 3 servers to one block.
The download there is not the same as what JWP1987 posted. I to am having problems with the tcpqueryport error. I do see on your website that it is working.
And in the earler post above you mention about the database queries but I dont see any difference in the ones that you posted and the ones in the original file. -edit- duh! I really should learn to read! Please ignore this.
Can you either post your code for the block you are using or post what you did to get it to work?
TIA
CaptDD Corporal
Joined: Jan 02, 2005
Posts: 51
Location: Manistee, MI, USA
Posted:
Mon May 09, 2005 3:52 pm
The biggest issue getting the block to work beyond the tcpqueryport error is making sure you edit the code to the correct TCP Query Port for your TS Server. If you host it yourself it is listed in the server.ini file. You need to be sure the port is open in your router if you use one. If you do not host it yourself you need to check with your host as to the port they have open for TCP Queries.
Be sure that you have followed the instructions carefully, I forgot to include them with my original zip file, they are there now. To be sure that the DB scrips are working properly check the to MySql tables for data.
Hope this helps
_________________
Dice101 Nuke Cadet
Joined: Nov 13, 2005
Posts: 1
Posted:
Mon Nov 14, 2005 11:12 am
Hey guys well i seem to be having a problem. I copyed the script on Page 1 on this thread and when i go to the blocks and add it, it says this
''Fatal error: Call to undefined function: getusrinfo() in /usr/export/www/hosting/mysitename/Includes/blocks/block_teamspeak.php on line 19.'' Does anybody have a clue of what that means? Thanks.
SDA_Marksman Nuke Cadet
Joined: Nov 23, 2005
Posts: 5
Posted:
Thu Nov 24, 2005 8:23 am
all these TS blocks are great, however everyone has skirted around the issue of 'What if your server has a server password?'
What do we do if the server has a password please?!
CaptDD Corporal
Joined: Jan 02, 2005
Posts: 51
Location: Manistee, MI, USA
Posted:
Thu Nov 24, 2005 3:07 pm
Hello,
Due to a contact made by a viewer of these posts, I have become aware that my links don't work as my previous clan folded.
@ SDA_Marksman - The TS block pulls the data from a query port of the TS Server. Passwords do not affect the blocks performance only players ability to log in via the block.
_________________
ssace Lieutenant
Joined: Dec 29, 2005
Posts: 175
Posted:
Sun Jan 29, 2006 12:45 pm
I tried the code at the top but it only served as a login point. the block had fields to enter nickname, username & password.
I need a block or module that will allow me to show 2 TS servers in the same block with channels that can be joined by clicking on the channel. I have found a block that works well with webpost but it can only show 1 server.
-Javier- Nuke Cadet
Joined: Nov 17, 2004
Posts: 5
Posted:
Wed Jul 04, 2007 7:50 pm
I have this block working in my web but now the TS server has password, How can I modify this script to allow connect to a server with password?
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