Quite
26-11-2006, 02:23
Hey peeps.
I added the addon Online Counter to our WoW-guild page the other night. The code looks like this:
<?
# TeamSpeak online counter v 1.0, 2006/02/14 10:11 CET
#
# Copyright (C) 2006 Bastian Schaar (www.teamspeak-einstieg.de)
#
# 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, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.
######################## CONFIG SECTION ########################
$server_address = "xx.xx.xx.xx"; # your teamspeak servers IP or DNS address
$server_tcpport = "51234"; # your teamspeak servers tcp port (default: 51234)
$server_udpport = "8767"; # your teamspeak servers udp port (default: 8767)
##################### TRANSLATION VARIABLES ####################
$lang_no = "No";
$lang_offline = "Server offline";
$lang_online = "online";
$lang_user = "member";
$lang_users = "members";
######################### SCRIPT START #########################
include("includes/tcpquery.class.php");
$tcpquery = new tcpquery;
if($socket = $tcpquery->connect($server_address, $server_tcpport)) {
$serverinfo = $tcpquery->get_serverinfo($server_udpport);
if($serverinfo) {
if ($serverinfo[server_currentusers] == 1) {
echo "document.write('$serverinfo[server_currentusers] $lang_user $lang_online');";
}
elseif ($serverinfo[server_currentusers] > 0) {
echo "document.write('$serverinfo[server_currentusers] $lang_users $lang_online');";
}
else {
echo "document.write('$lang_no $lang_users $lang_online');";
}
}
}
else {
echo "Server Offline";
}
?>
It works like a charm aslong as the server is online, but once it's offline, it simply wont display on the homepage. It refuses to. I've tried everything, but when the server is offline it just displays nothing. (BTW the script above is edited a bit cause I tried so many different things).
The homepage is here: http://magiknights.liquenox.net/toysoldiers/portal.php
Hope someone can help me to get it to show "offline". I really am puzzled as to why it wont show it....
I added the addon Online Counter to our WoW-guild page the other night. The code looks like this:
<?
# TeamSpeak online counter v 1.0, 2006/02/14 10:11 CET
#
# Copyright (C) 2006 Bastian Schaar (www.teamspeak-einstieg.de)
#
# 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, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.
######################## CONFIG SECTION ########################
$server_address = "xx.xx.xx.xx"; # your teamspeak servers IP or DNS address
$server_tcpport = "51234"; # your teamspeak servers tcp port (default: 51234)
$server_udpport = "8767"; # your teamspeak servers udp port (default: 8767)
##################### TRANSLATION VARIABLES ####################
$lang_no = "No";
$lang_offline = "Server offline";
$lang_online = "online";
$lang_user = "member";
$lang_users = "members";
######################### SCRIPT START #########################
include("includes/tcpquery.class.php");
$tcpquery = new tcpquery;
if($socket = $tcpquery->connect($server_address, $server_tcpport)) {
$serverinfo = $tcpquery->get_serverinfo($server_udpport);
if($serverinfo) {
if ($serverinfo[server_currentusers] == 1) {
echo "document.write('$serverinfo[server_currentusers] $lang_user $lang_online');";
}
elseif ($serverinfo[server_currentusers] > 0) {
echo "document.write('$serverinfo[server_currentusers] $lang_users $lang_online');";
}
else {
echo "document.write('$lang_no $lang_users $lang_online');";
}
}
}
else {
echo "Server Offline";
}
?>
It works like a charm aslong as the server is online, but once it's offline, it simply wont display on the homepage. It refuses to. I've tried everything, but when the server is offline it just displays nothing. (BTW the script above is edited a bit cause I tried so many different things).
The homepage is here: http://magiknights.liquenox.net/toysoldiers/portal.php
Hope someone can help me to get it to show "offline". I really am puzzled as to why it wont show it....