kein superadmin | $userIsSuperAdmin = true --> superadmin $userIsSuperAdmin = false; // Zeichen die nicht in einem Teamspeak-Usernamen vorkommen dürfen // TS-Standart: []{}() $disAllowedTSChars = array(" ", "[", "]", "{", "}", "(", ")"); // " " muss immer drin stehen "_" darf nicht drin stehen // /////////////////////////////////////////////////////////////////// /// Start-Script ///////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// $title = $allgAr['title'].' :: Teamspeak'; $hmenu = 'Teamspeak'; $authid = $_SESSION['authid']; $authname = $_SESSION['authname']; $tsUser = str_replace($disAllowedTSChars, "_", $authname); if( !empty($_POST["tsnickname"]) && !empty($_POST["tspwd"]) ) { // quicklogin submit $nickname = escape ($_POST["tsnickname"], "string"); $tsPwd = escape ($_POST["tspwd"], "string"); $nickname = str_replace($disAllowedTSChars, "_", $nickname); header("Location:teamspeak://$hostName:$serverPort?nickname=$nickname?loginname=$tsUser?password=$tsPwd"); } $design = new design ( $title , $hmenu ); $design->header(); $tpl = new tpl ( 'teamspeak.htm' ); try { $ts = new TsCommander(); $ts->connect($hostName, $queryPort); $ts->cmd("sel ". $serverPort); if($userIsSuperAdmin) $ts->cmd("slogin ". $loginName . " " . $loginPwd); else $ts->cmd("login ". $loginName . " " . $loginPwd); $userList = $ts->cmd("dbuserlist"); $tsUserID = escape(ts_getUserID($userList, $tsUser), "string"); $si = $ts->cmd("si"); $server_name = escape(ts_getSiValue("server_name", $si), "string"); $server_uptime = escape(ts_getSiValue("server_uptime", $si), "string"); $server_uptime = floor($server_uptime/60/60/24); $server_currentusers = escape(ts_getSiValue("server_currentusers", $si), "string"); $server_mbytessend = escape(ts_getSiValue("server_bytessend", $si), "string")/1024/1024; $server_mbytessend = round($server_mbytessend, 2); $server_mbytesreceived = escape(ts_getSiValue("server_bytesreceived", $si), "string")/1024/1024; $server_mbytesreceived = round($server_mbytesreceived, 2); $tpl->set("serverName", $server_name); $tpl->set("uptime", $server_uptime); $tpl->set("onlineUser", $server_currentusers); $tpl->set("mbytesreceived", $server_mbytesreceived); $tpl->set("mbytessend", $server_mbytessend); $tpl->set("hostName", $hostName); $tpl->set("serverPort", $serverPort); $tpl->set("tsUser", $tsUser); if( strtolower($loginName) == strtolower($tsUser)){ throw new Exception("Der Ilch Loginname und der Teamspeak-Admin-Loginname dürfen aus Sicherheitsgründen nicht identisch sein."); }else if(strtolower($tsUser) == "gast"){ throw new Exception("Gäste können keinen Teamspeak-Account erstellen."); }else { if( isset($_POST["tsaction"]) && $tsUserID){ /// button gedrückt user vorhanden $tsPwd = ts_getNewPwd(); $ts->cmd("dbuserchangepw $tsUserID $tsPwd $tsPwd"); $tpl->set("tsOk", "Das Passwort wurde geändert. Die neuen Zugangdaten wurden dir per PM zugesendet."); $tpl->set("type", "exists"); ts_sendPM($authid, $tsUser, $tsPwd); $tpl->out(0); $tpl->out(2); }else if(isset($_POST["tsaction"]) && !$tsUserID){ /// button gedrückt user nicht vorhanden $tsPwd = ts_getNewPwd(); $ts->cmd("dbuseradd $tsUser $tsPwd $tsPwd 0"); $tpl->set("tsOk", "Ein neuer Teamspeak-Account wurde erstellt. Die neuen Zugangdaten wurden dir per PM zugesendet."); $tpl->set("type", "new"); ts_sendPM($authid, $tsUser, $tsPwd); $tpl->out(0); $tpl->out(2); }else if(!isset($_POST["tsaction"]) && $tsUserID) { /// button nicht gedrückt user vorhanden $tpl->set("valueTsAction", "Neues Passwort setzten"); $tpl->set("type", "exists"); $tpl->out(0); $tpl->out(3); }else { /// button nicht gedrückt user nicht vorhanden $tpl->set("valueTsAction", "Neuen Account erstellen"); $tpl->set("type", "new"); $tpl->out(0); $tpl->out(3); } } $tpl->out(4); }catch(Exception $e) { /// fehler in der ts kommunikation if($e->getCode() == -1 || $e->getCode() == -2) { /// server ist offline bzw kein TS-Server $tpl->out(5); }else { $tpl->set("tsFail", $e->getMessage()); /// server ist online aber error $tpl->out(0); $tpl->out(1); } } $design->footer(); } /// Sichert ab das keine Varibalen überschrieben werden. ?>