Col. Angel -MRU-
13-09-2004, 08:18
:confused: Alrighty, I've searched these forums through and through, and I've yet to find exactly what I'm looking for.
All I'm needing is a basic html script to show my TS Server on my PHP website hosted by Squad Engine (http://www.squadengine.com). I don't have access to the pages directly, but I can easily add an html script to a forum post and have it display on another page.
Trust me, I've spent the last couple hours looking through the forums trying to find something I can use, to no avail.
:confused:
I don't trust you because the answers to what you seek are one and two threads below yours.
I think you're just lazy. Well, to my knowledge none of the solutions come with an auto-installer, good luck :p
Col. Angel -MRU-
15-09-2004, 05:55
Brain,
I have to use HTML, PHP won't work on how I have to set it up, otherwise... I would use one of the others. I've tried to embed the PHP into an HTML page, but that didn't prove fruitful.
I need there to be a way for it to use HTML, no other way will work the way I want it too.
I see. Then I guess it will be nothing because just (X)HTML won't do, unless there's an extension to the w3c standards which I don't know about, something like:
<showts2status ip="192.168.4.19" style="background:purple;filetree:annoyingly-shifty" />
generating dynamic code with HTML ? That would be completly new to me.
Col. Angel -MRU-
15-09-2004, 19:06
If not HTML, possibly a Java Script?
nope LOL :D
But there's a guy who wrote a flash to display the server status, however he requires a small fee for that
Col. Angel -MRU-
16-09-2004, 10:51
It never hurts to ask. Well, thanks anyway. :)
DogShxt Taco
18-09-2004, 04:59
Sorry if I'm missing something, here...
All I'm needing is a basic html script to show my TS Server on my PHP website hosted by Squad Engine.
and
I have to use HTML, PHP won't work on how I have to set it up.
Okay. So...can you use php on your website or not? If you can use it on one server, but not the other, have you considered using (shudder) frames, normal or inline? I'm sure there's a way around your problem, I'm just not clear what that problem really is. Can you be more specific?
MoG_Pontius
17-10-2004, 20:30
I found this as a phpnuke block that works pretty good on just showing who is on the server and the channel they are in... Just copy this whole thing, change the $serverAddress to what you want and name the file as "TS.php". It hasn't failed me yet.
<?php
$usemarquee = 0;
$scrolldirection = "Up";
// **** settings - to be edited before first use ****
$serverAddress = "XXXXXXXXXXXXX"; // 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.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 "OK" 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=\"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=\"bullet_0.gif\" border=\"0\" align=absmiddle> " . $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>";
?>
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.