Ejemplo n.º 1
0
 $i = 0;
 $folders = substr($row2['serverdir'], 0, 1) == '/' ? 'cd  /' : 'cd ';
 while ($i <= $folderfilecount) {
     $folders = $folders . $split_config[$i] . '/';
     $i++;
 }
 $folders = $folders == 'cd ' ? '' : $folders . ' && ';
 $tsdown = false;
 $tsdnsdown = false;
 $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
 $errorcode = $connection->errorcode;
 if (strpos($errorcode, 'error id=0') === false) {
     $connection->CloseConnection();
     unset($connection);
     sleep(1);
     $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
     $errorcode = $connection->errorcode;
 }
 if (strpos($errorcode, 'error id=0') === false) {
     $connection->CloseConnection();
     unset($connection);
     $tsdown = true;
     print "TS3 Query Error: " . $errorcode . "\r\n";
     $restartreturn = "TS3";
 }
 if ($row2['usedns'] == 'Y' and $tsdnsExternalActive == false) {
     $tsdnscheck = @fsockopen($queryip, 41144, $errno, $errstr, 5);
     if (!is_resource($tsdnscheck)) {
         sleep(1);
         $tsdnscheck = @fsockopen($queryip, 41144, $errno, $errstr, 5);
     }
Ejemplo n.º 2
0
         $publickey = $row['publickey'];
         $queryip = $row['ssh2ip'];
         $ssh2port = $row['decryptedssh2port'];
         $ssh2user = $row['decryptedssh2user'];
         $ssh2password = $row['decryptedssh2password'];
         $keyname = $row['keyname'];
     } else {
         if ($addedby == 1) {
             $query = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
             $query->execute(array($row['rootid'], $reseller_id));
             $queryip = $query->fetchColumn();
         }
     }
 }
 if (isset($queryip, $volocalserverid)) {
     $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->st('action', 'post') == 'dl') {
             $return = $connection->banDel($volocalserverid, $ui->id('bannID', 19, 'post'));
             $template_file = $return ? $spracheResponse->ts_query_success . $return : $spracheResponse->error_table;
         } else {
             if ($ui->st('action', 'post') == 'ad') {
                 if ($ui->w('banType', 1, 'post') == 'I' and $ui->ip4('ip', 'post')) {
                     $banCmd = 'banadd ip=' . $ui->ip4('ip', 'post');
                 } else {
                     if ($ui->w('banType', 1, 'post') == 'N' and strlen($ui->escaped('name', 'post')) > 0) {
                         $banCmd = 'banadd name=' . $connection->ReplaceToTS3($ui->escaped('name', 'post'));
                     } else {
Ejemplo n.º 3
0
        $hostbutton_url = $row['defaulthostbutton_url'];
        $hostbutton_gfx_url = $row['defaulthostbutton_gfx_url'];
        $flexSlotsFree = $row['defaultFlexSlotsFree'];
        $flexSlotsPercent = $row['defaultFlexSlotsPercent'];
    }
    if ($ui->id('serverID', 10, 'get') and isset($masterServerData)) {
        $query = $sql->prepare("SELECT `localserverid`,`ip`,`dns`,`flexSlots`,`flexSlotsPercent`,`flexSlotsFree` FROM `voice_server` WHERE `id`=? AND `resellerid`=? LIMIT 1");
        $query->execute(array($ui->id('serverID', 10, 'get'), $resellerLockupID));
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $localID = $row['localserverid'];
            $currentIP = $row['ip'];
            $dns = $row['dns'];
            $flexSlots = $row['flexSlots'];
            $flexSlotsPercent = $row['flexSlotsPercent'];
            $flexSlotsFree = $row['flexSlotsFree'];
        }
        $connection = new TS3($masterServerData['ssh2ip'], $masterServerData['queryport'], 'serveradmin', $masterServerData['decryptedquerypassword']);
        if (strpos($connection->errorcode, 'error id=0') !== false and isset($localID)) {
            $serverDetails = $connection->ServerDetails($localID);
            $name = $serverDetails['virtualserver_name'];
            $welcome = $serverDetails['virtualserver_welcomemessage'];
            $hostbanner_url = $serverDetails['virtualserver_hostbanner_url'];
            $hostbanner_gfx_url = $serverDetails['virtualserver_hostbanner_gfx_url'];
            $hostbutton_tooltip = $serverDetails['virtualserver_hostbutton_tooltip'];
            $hostbutton_url = $serverDetails['virtualserver_hostbutton_url'];
            $hostbutton_gfx_url = $serverDetails['virtualserver_hostbutton_gfx_url'];
        }
        $connection->CloseConnection();
    }
}
require_once IncludeTemplate($template_to_use, 'ajax_admin_voice_server_usage.tpl', 'ajax');
Ejemplo n.º 4
0
     if ($addedby == 1) {
         $query3 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
         $query3->execute(array($row2['rootid'], $row['resellerID']));
         $queryip = $query3->fetchColumn();
     } else {
         $publickey = $row2['publickey'];
         $queryip = $row2['ssh2ip'];
         $ssh2port = $row2['decryptedssh2port'];
         $ssh2user = $row2['decryptedssh2user'];
         $ssh2password = $row2['decryptedssh2password'];
         $keyname = $row2['keyname'];
         $bitversion = $row2['bitversion'];
     }
 }
 if (isset($queryip, $queryport)) {
     $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
     $errorcode = $connection->errorcode;
     if (!isset($errorcode) or strpos($errorcode, 'error id=0') === false) {
         $query2 = $sql->prepare("UPDATE `jobs` SET `status`='1' WHERE `status` IS NULL AND `type`='vo' AND `hostID`=?");
         $query2->execute(array($row['hostID']));
     } else {
         $localserverid = false;
         $query2 = $sql->prepare("SELECT * FROM `jobs` WHERE (`status` IS NULL OR `status`='1') AND `type`='vo' AND `hostID`=?");
         $query2->execute(array($row['hostID']));
         while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
             $extraData = @json_decode($row2['extraData']);
             $query3 = $sql->prepare("SELECT * FROM `voice_server` WHERE `id`=? AND `resellerid`=? LIMIT 1");
             $query3->execute(array($row2['affectedID'], $row2['resellerID']));
             while ($row3 = $query3->fetch(PDO::FETCH_ASSOC)) {
                 $userId = $row3['userid'];
                 $active = $row3['active'];
Ejemplo n.º 5
0
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $publickey = $row['publickey'];
         $ssh2port = $row['decryptedssh2port'];
         $ssh2user = $row['decryptedssh2user'];
         $ssh2password = $row['decryptedssh2password'];
         $serverdir = $row['serverdir'];
         $keyname = $row['keyname'];
         $bitversion = $row['bitversion'];
         if ($externalDefaultDNS == 'Y') {
             $defaultdns = $row['defaultdns'];
         }
         $TSDNSSsh2ip = $row['connect_ip_only'] == 'Y' ? $row['external_ip'] : $row['ssh2ip'];
     }
 }
 // Connect to TS3 Server. Only if successfull do the import
 $connection = new TS3($ssh2ip, $queryport, 'serveradmin', $querypassword);
 if ($connection->socketConnected === true and strpos($connection->errorcode, 'error id=0') !== false) {
     foreach ($ui->id('virtualserver_id', 19, 'post') as $virtualserver_id) {
         if ($ui->active("{$virtualserver_id}-import", 'post') == 'Y') {
             $customerID = $ui->id("{$virtualserver_id}-customer", 10, 'post');
             if ($customerID == 0 or $customerID == false or $customerID == null) {
                 $usernew = true;
                 if ($ui->username("{$virtualserver_id}-username", 50, 'post') and $ui->ismail("{$virtualserver_id}-email", 'post')) {
                     $query = $sql->prepare("SELECT `id` FROM `userdata` WHERE `cname`=? AND `mail`=? AND `resellerid`=? LIMIT 1");
                     $query->execute(array($ui->username("{$virtualserver_id}-username", 50, 'post'), $ui->ismail("{$virtualserver_id}-email", 'post'), $reseller_id));
                     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                         $usernew = false;
                         $customerID = $row['id'];
                         $cnamenew = $ui->username("{$virtualserver_id}-username", 50, 'post');
                     }
                     if ($usernew == true) {
Ejemplo n.º 6
0
     $serverdir = $row['serverdir'];
     $publickey = $row['publickey'];
     $queryip = $row['ssh2ip'];
     $ssh2port = $row['decryptedssh2port'];
     $ssh2user = $row['decryptedssh2user'];
     $ssh2password = $row['decryptedssh2password'];
     $keyname = $row['keyname'];
     $bitversion = $row['bitversion'];
 } else {
     if ($addedby == 1) {
         $query2 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
         $query2->execute(array($row['rootid'], $reseller_id));
         $queryip = $query2->fetchColumn();
     }
 }
 $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
 $errorcode = $connection->errorcode;
 if (strpos($errorcode, 'error id=0') === false) {
     $connecterror = $errorcode;
 } else {
     $query2 = $sql->prepare("SELECT * FROM `voice_server` WHERE `lendserver`='Y' AND `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
     $query2->execute(array($tousevoiceid, $reseller_id));
     while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
         $voip = $row2['ip'];
         $voport = $row2['port'];
         $vodns = $row2['dns'];
         $max_download_total_bandwidth = $row2['max_download_total_bandwidth'];
         $max_upload_total_bandwidth = $row2['max_upload_total_bandwidth'];
         $volocalserverid = $row2['localserverid'];
         $forcebanner = $row2['forcebanner'];
         $forcebutton = $row2['forcebutton'];
Ejemplo n.º 7
0
         $queryip = $row['ssh2ip'];
         $ssh2port = $row['decryptedssh2port'];
         $ssh2user = $row['decryptedssh2user'];
         $ssh2password = $row['decryptedssh2password'];
         $keyname = $row['keyname'];
         $bitversion = $row['bitversion'];
     } else {
         if ($addedby == 1) {
             $query = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
             $query->execute(array($row['rootid'], $resellerLockupID));
             $queryip = $query->fetchColumn();
         }
     }
 }
 if (isset($queryip) and $ui->w('safeDelete', 1, 'post') != 'D') {
     $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
     $errorcode = $connection->errorcode;
     if (isset($localserverid) and strpos($errorcode, 'error id=0') !== false) {
         $connection->DelServer($localserverid);
         $errorcode = $connection->errorcode;
         $connection->CloseConnection();
     }
 }
 if ($ui->w('safeDelete', 1, 'post') != 'S' or isset($errorcode) and strpos($errorcode, 'error id=0') !== false) {
     $query = $sql->prepare("DELETE FROM `voice_server` WHERE `id`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($id, $resellerLockupID));
     $query = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `affectedID`=? AND `type`='vo'");
     $query->execute(array($id));
     customColumns('T', $id, 'del');
     $query = $sql->prepare("DELETE b.* FROM `voice_server_backup` b LEFT JOIN `voice_server` v ON b.`sid`=v.`id` WHERE v.`id` IS NULL");
     $query->execute();
Ejemplo n.º 8
0
                     $left = 0;
                     printText('404: File not found');
                 }
             }
         }
     }
 }
 // As we cannot import the virtual server IDs we need to get them afterwards
 $query = $sql->prepare("SELECT DISTINCT(`masterserver`) FROM `voice_server` WHERE `resellerid`=? AND (`localserverid`<1 OR `localserverid` IS NULL)");
 $query2 = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `active`='Y' AND `id`=:id LIMIT 1");
 $query3 = $sql->prepare("UPDATE `voice_server` SET `localserverid`=? WHERE `masterserver`=? AND `resellerid`=? AND `port`=? AND (`localserverid`<1 OR `localserverid` IS NULL)");
 $query->execute(array($resellerID));
 while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
     $query2->execute(array(':aeskey' => $aeskey, ':id' => $row2['masterserver']));
     while ($row3 = $query2->fetch(PDO::FETCH_ASSOC)) {
         $ts3 = new TS3($row3['ssh2ip'], $row3['queryport'], 'serveradmin', $row3['decryptedquerypassword'], false);
         if (strpos($ts3->errorcode, 'error id=0') !== false) {
             $serverlist = $ts3->ServerList();
             if (!isset($serverlist[0]['id']) or $serverlist[0]['id'] == 0) {
                 foreach ($serverlist as $server) {
                     $query3->execute(array($server['virtualserver_id'], $row2['masterserver'], $resellerID, $server['virtualserver_port']));
                 }
             }
         }
     }
 }
 // Substitutes
 unset($left);
 $start = 0;
 // Prepare queries only once to avoid overhead
 $query2 = $sql->prepare("SELECT `sID` FROM `userdata_substitutes` WHERE `sourceSystemID`=? AND `externalID`=? AND `resellerID`=? LIMIT 1");
Ejemplo n.º 9
0
     if ($time == 0 or $shutDownEmpty == 'Y' and $row['lendtime'] - $timeleft > $shutDownEmptyTime and $row['usedslots'] < 1) {
         $query2->execute(array($aeskey, $row['id'], $reseller_id));
         while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
             $queryport = $row2['queryport'];
             $querypassword = $row2['decryptedquerypassword'];
             $addedby = $row2['addedby'];
             $localserverid = $row2['localserverid'];
             if ($addedby == 2) {
                 $queryip = $row2['ssh2ip'];
             } else {
                 if ($addedby == 1) {
                     $query4->execute(array($row2['rootid'], $reseller_id));
                     $queryip = $query4->fetchColumn();
                 }
             }
             $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
             $errorcode = $connection->errorcode;
             if (strpos($errorcode, 'error id=0') !== false) {
                 $connection->StopServer($localserverid);
             }
             $connection->CloseConnection();
             $deleteQuery->execute(array($row['lend_id']));
             $time = 0;
             $lendID = null;
         }
         if (!isset($vonextfree) or $vonextfree > $timeleft) {
             $vonextfree = $timeleft;
         }
     }
 }
 $lendVoiceServers[] = array('id' => $lendID, 'password' => $row['password'], 'ip' => $row['ip'], 'port' => (int) $row['port'], 'queryName' => htmlentities($row['queryName'], ENT_QUOTES, 'UTF-8'), 'connect' => $row['dns'], 'slots' => (int) $slots, 'usedslots' => (int) $row['usedslots'], 'timeleft' => $time);