* @see http://tsstatus.sebastien.me/ * @version 2013-08-31 **/ $enableGenerator = false; $absoluteDir = dirname(__FILE__) . "/"; $wwwDir = substr($_SERVER["SCRIPT_NAME"], 0, strrpos($_SERVER["SCRIPT_NAME"], "/") + 1); $host = isset($_POST["host"]) ? $_POST["host"] : ""; $qport = isset($_POST["qport"]) ? intval($_POST["qport"]) : 10011; $portOrId = isset($_POST["portOrId"]) ? intval($_POST["portOrId"]) : 1; $port = isset($_POST["port"]) ? intval($_POST["port"]) : 9987; $sid = isset($_POST["sid"]) ? intval($_POST["sid"]) : 1; $showNicknameBox = !isset($_POST["showNicknameBox"]); $timeout = isset($_POST["timeout"]) ? intval($_POST["timeout"]) : 2; $showPasswordBox = !isset($_POST["showPasswordBox"]); $serverQueryLogin = isset($_POST["serverQueryLogin"]) ? $_POST["serverQueryLogin"] : ""; $serverQueryPassword = isset($_POST["serverQueryPassword"]) ? $_POST["serverQueryPassword"] : ""; $cacheTime = isset($_POST["cacheTime"]) ? intval($_POST["cacheTime"]) : 0; $cacheFile = isset($_POST["cacheFile"]) ? $_POST["cacheFile"] : ""; $limitToChannels = isset($_POST["limitToChannels"]) ? $_POST["limitToChannels"] : ""; $hideEmptyChannels = !isset($_POST["hideEmptyChannels"]); $hideParentChannels = !isset($_POST["hideParentChannels"]); if($timeout < 1) $timeout = 0; else if($timeout > 10) $timeout = 10; $htmlCode = ' '; echo $htmlCode; $phpCode = "useServerPort(' . $port . ');' . "\n"; if($portOrId == 2) $phpCode .= '$tsstatus->useServerId(' . $sid . ');' . "\n"; $phpCode .= '$tsstatus->imagePath = "' . $wwwDir . 'img/";' . "\n"; $phpCode .= '$tsstatus->timeout = ' . $timeout . ";\n"; if($serverQueryLogin != "") $phpCode .= '$tsstatus->setLoginPassword("'.$serverQueryLogin.'", "'.$serverQueryPassword.'");' . "\n"; if($cacheTime > 0 && $cacheFile == "") $phpCode .= '$tsstatus->setCache('.$cacheTime.');' . "\n"; if($cacheTime > 0 && $cacheFile != "") $phpCode .= '$tsstatus->setCache('.$cacheTime.', "'.$cacheFile.'");' . "\n"; if($limitToChannels != "") $phpCode .= '$tsstatus->limitToChannels('.$limitToChannels.');' . "\n"; $phpCode .= '$tsstatus->hideEmptyChannels = ' . (!$hideEmptyChannels ? "true" : "false") . ";\n"; $phpCode .= '$tsstatus->hideParentChannels = ' . (!$hideParentChannels ? "true" : "false") . ";\n"; $phpCode .= '$tsstatus->showNicknameBox = ' . ($showNicknameBox ? "true" : "false") . ";\n"; $phpCode .= '$tsstatus->showPasswordBox = ' . ($showPasswordBox ? "false" : "true") . ";\n"; $phpCode .= 'echo $tsstatus->render();' . "\n?>"; ?> TSStatus generator

TSStatus generator

Host Your Teamspeak server hostname or ip
Query port Server's query port, not the client port! (default 10011)
Server Port /> You must define a server port or a server id to connect to
Server Id />
Timeout The timeout, in seconds, for connect, read, write operations
ServerQuery login [Optional] The ServerQuery login used by tsstatus
ServerQuery password [Optional] The ServerQuery password
Cache time [Optional] Cache datas for X seconds before updating (prevent bans from the server). 0 => disabled
Cache file [Optional] The file were the datas will be stored (.../tsstatus/tsstatus.php.cache if not specified)
Limit to these channels [Optional] Comma seperated list of channels ID to display. If set TSStatus will only render these channels
To use with "Limit to these channels" and "Hide empty channels" options
The box will only be visible if the the server have a password
TSStatus result\n"; require_once($absoluteDir . "tsstatus.php"); $tsstatus = new TSStatus($host, $qport); $tsstatus->imagePath = $wwwDir . "img/"; if($portOrId == 1) $tsstatus->useServerPort($port); if($portOrId == 2) $tsstatus->useServerId($sid); $tsstatus->timeout = $timeout; if($serverQueryLogin != "") $tsstatus->setLoginPassword($serverQueryLogin, $serverQueryPassword); if($cacheTime > 0 && $cacheFile == "") $tsstatus->setCache($cacheTime); if($cacheTime > 0 && $cacheFile != "") $tsstatus->setCache($cacheTime, $cacheFile); if($limitToChannels != "") { $ids = explode(",", $limitToChannels); call_user_func_array(array($tsstatus, "limitToChannels"), $ids); } $tsstatus->hideEmptyChannels = !$hideEmptyChannels; $tsstatus->hideParentChannels = !$hideParentChannels; $tsstatus->showNicknameBox = $showNicknameBox; $tsstatus->showPasswordBox = !$showPasswordBox; echo $tsstatus->render(); echo "

HTML code

\n"; highlight_string($htmlCode); echo "

PHP code

\n"; highlight_string($phpCode); echo "

Full page sample

\n"; highlight_string("\n\nTSStatus\n$htmlCode\n\n\n$phpCode\n\n"); echo '


Don\'t forget to disable this script once finished testing!
'; } } else { echo '
This script is disabled by default for security purposes!
To enable the script you have to edit tsstatusgen.php and replace $enableGenerator = false; by $enableGenerator = true; on line 10
Don\'t forget to disable this script once finished testing!
'; } ?>