$connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
 $errorcode = $connection->errorcode;
 if (strpos($errorcode, 'error id=0') === false) {
     $template_file = $spracheResponse->error_ts_query_connect . $errorcode;
 } else {
     if ($ui->port('po', 'get') == 1) {
         $servergroups = array();
         foreach ($connection->ServerGroups($localserverid) as $servergroup) {
             if ($servergroup['type'] == 1) {
                 $servergroups[$servergroup['id']] = $servergroup['name'];
             }
         }
         $template_file = 'userpanel_voiceserver_key_add.tpl';
     } else {
         if (!$ui->smallletters('action', 2, 'post') and !$ui->port('po', 'get')) {
             $pklist = $connection->KeyList($localserverid);
             configureDateTables('-1', '0, "asc"');
             $template_file = is_array($pklist) ? 'userpanel_voiceserver_key_list.tpl' : $spracheResponse->ts_query_success . $pklist;
         } else {
             if ($ui->smallletters('action', 2, 'post') == 'ad') {
                 if ($ui->id('group', 255, 'post')) {
                     $newkey = $connection->AddKey($localserverid, $ui->id('group', 255, 'post'));
                     $template_file = $spracheResponse->ts_query_success . $newkey[0]['token'];
                     $loguseraction = '%add% %voserver% Token ' . $address;
                     $insertlog->execute();
                 }
             } else {
                 if ($ui->smallletters('action', 2, 'post') == 'dl') {
                     $del = $connection->DelKey($localserverid, $ui->post['token']);
                     $template_file = $spracheResponse->ts_query_success . $del[0]['msg'];
                     $loguseraction = '%del% %voserver% Token ' . $address;