Пример #1
0
                 $esxi = $ui->post['esxi'];
                 $ip = $ui->post['ip'];
                 $thin = $ui->post['thin'];
                 $thinquota = isid($ui->post['thinquota'], "2");
                 $port = $ui->post['port'];
                 $reseller = $ui->post['reseller'];
                 $user = $ui->post['user'];
                 $pass = $ui->startparameter('pass', 'post');
                 $os = "linux";
                 $description = $ui->description('description', 'post');
                 $cores = isid($ui->post['cores'], "5");
                 $cpu = $ui->description('cpu', 'post');
                 $mhz = isid($ui->post['mhz'], "5");
                 $ram = isid($ui->post['ram'], "5");
                 $hdd = $ui->startparameter('hdd', 'post');
                 $maxserver = isid($ui->post['maxserver'], "3");
                 $pinsert = $sql->prepare("UPDATE `virtualhosts` SET `active`=:active,`esxi`=:esxi,`ip`=:ip,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user,:aeskey),`pass`=AES_ENCRYPT(:pass,:aeskey),`os`=:os,`description`=:description,`publickey`=:publickey,`keyname`=:keyname,`cpu`=:cpu,`cores`=:cores,`mhz`=:mhz,`hdd`=:hdd,`ram`=:ram,`maxserver`=:maxserver,`thin`=:thin,`thinquota`=:thinquota,`resellerid`=:reseller WHERE `id`=:id LIMIT 1");
                 $pinsert->execute(array(':active' => $active, ':esxi' => $esxi, ':ip' => $ip, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':description' => $description, ':publickey' => $publickey, ':keyname' => $keyname, ':cpu' => $cpu, ':cores' => $cores, ':mhz' => $mhz, ':hdd' => $hdd, ':ram' => $ram, ':maxserver' => $maxserver, ':id' => $id, ':thin' => $thin, ':thinquota' => $thinquota, ':reseller' => $reseller));
                 $template_file = $spracheResponse->table_add;
                 $loguseraction = "%mod% %virtual% {$ip}";
                 $insertlog->execute();
             }
         } else {
             $template_file = 'admin_404.tpl';
         }
     }
 } else {
     $table = array();
     $o = $ui->st('o', 'get');
     if ($ui->st('o', 'get') == 'ap') {
         $orderby = 'h.`ip` ASC';
Пример #2
0
 while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
     $foundGroupIDs[] = $row['groupID'];
 }
 $query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
 if (isset($data['groupID']) and isid($data['groupID'], 19)) {
     $query->execute(array($data['groupID'], $resellerID));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $userGroupIDs[] = $row['id'];
     }
 } else {
     if (isset($data['groupID'])) {
         if (!is_array($data['groupID']) and !is_object($data['groupID'])) {
             $data['groupID'] = array($data['groupID']);
         }
         foreach ($data['groupID'] as $groupID) {
             if (isid($groupID, 19)) {
                 $query->execute(array($groupID, $resellerID));
                 while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                     $userGroupIDs[] = $row['id'];
                 }
             }
         }
     }
 }
 if (count($userGroupIDs) > 0) {
     $query = $sql->prepare("DELETE FROM `userdata_groups` WHERE `userID`=? AND `groupID`=? AND `resellerID`=? LIMIT 1");
     foreach ($foundGroupIDs as $groupID) {
         if (!in_array($groupID, $userGroupIDs)) {
             $query->execute(array($localID, $groupID, $resellerID));
         }
     }
Пример #3
0
             $query2 = $sql->prepare("SELECT `ip`,`bitversion` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
             $query2->execute(array($row['rootid'], $resellerToUse));
             while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
                 $queryip = $row2['ip'];
                 $bitversion = $row2['bitversion'];
             }
         }
     }
 }
 if (!isset($masteractive) or !isset($usedns) or $masteractive == 'N') {
     $template_file = 'userpanel_404.tpl';
 } else {
     $dns = strtolower($ui->domain('dns', 'post'));
     $dnsCheck = checkDNS($dns, $id, $user_id, $type = 'server');
     if ($usedns == 'Y' and $dns != $olddns and $dns != '' and $dnsCheck !== false) {
         if (isset($tsdnsServerID) and isid($tsdnsServerID, 10) and isset($resellerToUse)) {
             $query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
             $query->execute(array(':aeskey' => $aeskey, ':id' => $tsdnsServerID, ':reseller_id' => $resellerToUse));
             while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                 $publickey = $row['publickey'];
                 $queryip = $row['ssh2ip'];
                 $ssh2port = $row['decryptedssh2port'];
                 $ssh2user = $row['decryptedssh2user'];
                 $ssh2password = $row['decryptedssh2password'];
                 $serverdir = $row['serverdir'];
                 $keyname = $row['keyname'];
                 $bit = $row['bitversion'];
                 $bitversion = $row['bitversion'];
             }
         }
         $return = tsdns('md', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip, $oldip), array($port, $oldport), array($dns, $olddns), $reseller_id);
Пример #4
0
 function customColumns($item, $id = 0, $action = false, $api = false)
 {
     global $sql, $user_language, $default_language;
     $return = array();
     if ($id !== null) {
         $query = $sql->prepare("SELECT * FROM `custom_columns_settings` WHERE `item`=? AND `active`='Y'");
         $query->execute(array($item));
         if ($action == false) {
             $query2 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='cc' AND `transID`=? AND `lang`=? LIMIT 1");
             $query3 = $sql->prepare("SELECT `var` FROM `custom_columns` WHERE `customID`=? AND `itemID`=? LIMIT 1");
             while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                 $text = '';
                 $query2->execute(array($row['customID'], $user_language));
                 while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
                     $text = $row2['text'];
                 }
                 if (empty($text)) {
                     $query2->execute(array($row['customID'], $default_language));
                     while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
                         $text = $row2['text'];
                     }
                 }
                 $type = $row['type'] == 'I' ? 'number' : 'text';
                 $query3->execute(array($row['customID'], $id));
                 $value = $id == 0 ? '' : $query3->fetchColumn();
                 $return[] = array('customID' => $row['customID'], 'menu' => $text, 'name' => $row['name'], 'length' => $row['length'], 'type' => $row['type'], 'input' => "<input id='inputCustom-{$row['customID']}' type='{$type}' name='{$row['name']}' maxlength='{$row['length']}' value='{$value}' >", 'value' => $value);
             }
         } else {
             if ($action == 'save') {
                 $return = 0;
                 $query2 = $sql->prepare("INSERT INTO `custom_columns` (`customID`,`itemID`,`var`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `var`=VALUES(`var`)");
                 if ($api == false) {
                     global $ui;
                     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                         $var = '';
                         if ($row['type'] == 'I' and $ui->id($row['name'], $row['length'], 'post')) {
                             $var = $ui->id($row['name'], $row['length'], 'post');
                         } else {
                             if ($ui->names($row['name'], $row['length'], 'post')) {
                                 $var = $ui->names($row['name'], $row['length'], 'post');
                             }
                         }
                         $query2->execute(array($row['customID'], $id, $var));
                         $return += $query2->rowCount();
                     }
                 } else {
                     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                         $var = '';
                         if (isset($api[$row['name']])) {
                             if ($row['type'] == 'I') {
                                 $var = isid($api[$row['name']], $row['length']);
                             } else {
                                 if (names($api[$row['name']], $row['length'])) {
                                     $var = names($api[$row['name']], $row['length']);
                                 }
                             }
                             $query2->execute(array($row['customID'], $id, $var));
                             $return += $query2->rowCount();
                         }
                     }
                 }
             } else {
                 if ($action == 'del') {
                     $return = 0;
                     $query2 = $sql->prepare("DELETE FROM `custom_columns` WHERE `customID`=? AND `itemID`=? LIMIT 1");
                     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                         $query2->execute(array($row['customID'], $id));
                         $return += $query2->rowCount();
                     }
                 }
             }
         }
     }
     return $return;
 }
Пример #5
0
function checkDNS($dns, $id = null, $user_id = null, $type = '')
{
    global $sql, $reseller_id;
    if ($type == 'server') {
        $query = $sql->prepare("SELECT `masterserver` FROM `voice_server` WHERE `id`=? AND `resellerid`=? LIMIT 1");
        $query->execute(array($id, $reseller_id));
        $masterID = $query->fetchColumn();
        $query = $sql->prepare("SELECT `tsdnsID` FROM `voice_dns` WHERE `dns`=? AND `resellerID`=? LIMIT 1");
        $query->execute(array($dns, $reseller_id));
        $query2 = $sql->prepare("SELECT `masterserver` FROM `voice_server` WHERE `id`!=? AND `dns`=? AND `resellerid`=? LIMIT 1");
        $query2->execute(array($id, $dns, $reseller_id));
    } else {
        if ($type == 'dns') {
            $query = $sql->prepare("SELECT `tsdnsID` FROM `voice_dns` WHERE `dnsID`!=? AND `resellerID`=? LIMIT 1");
            $query->execute(array($id, $reseller_id));
            $masterID = $query->fetchColumn();
            $query = $sql->prepare("SELECT `tsdnsID` FROM `voice_dns` WHERE `dnsID`!=? AND `dns`=? AND `resellerID`=? LIMIT 1");
            $query->execute(array($id, $dns, $reseller_id));
            $query2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `dns`=? AND `resellerid`=? LIMIT 1");
            $query2->execute(array($dns, $reseller_id));
        } else {
            $query = $sql->prepare("SELECT `tsdnsID` FROM `voice_dns` WHERE `dns`=? AND `resellerID`=? LIMIT 1");
            $query->execute(array($dns, $reseller_id));
            $query2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `dns`=? AND `resellerid`=? LIMIT 1");
            $query2->execute(array($dns, $reseller_id));
        }
    }
    if ($query->rowCount() > 0 or $query2->rowCount() > 0) {
        return false;
    }
    if ($user_id != null) {
        $serverdnsArray = array();
        $query = $sql->prepare("SELECT `id`,`defaultdns`,`externalDefaultDNS`,`tsdnsServerID` FROM `voice_masterserver` WHERE `resellerid`=?");
        $query->execute(array($reseller_id));
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            if ($row['externalDefaultDNS'] == 'N') {
                unset($temp);
                if ($type == 'server' and $id != null and $row['id'] == $masterID) {
                    $defaultdns = strtolower($id . '.' . $row['defaultdns']);
                    $partCount = count(explode('.', $defaultdns));
                }
                $ex = explode('.', $row['defaultdns']);
                $i = count($ex) - 1;
                while ($i >= 0) {
                    $serverdnsArray[] = isset($temp) ? $ex[$i] . '.' . $temp : $ex[$i];
                    $i--;
                }
            } else {
                if ($type == 'server' and $row['externalDefaultDNS'] == 'Y' and $id != null and $row['id'] == $masterID) {
                    $tsdnsServerID = $row['tsdnsServerID'];
                }
            }
        }
        $query = $sql->prepare("SELECT `id`,`defaultdns` FROM `voice_tsdns` WHERE `resellerid`=?");
        $query->execute(array($reseller_id));
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            unset($temp);
            if (isset($tsdnsServerID) and $id != null and $row['id'] == $tsdnsServerID or $type == 'dns' and $id != null and $row['id'] == $masterID) {
                $defaultdns = strtolower($id . '-' . getusername($user_id) . '.' . $row['defaultdns']);
                $partCount = count(explode('.', $defaultdns));
            }
            $ex = explode('.', $row['defaultdns']);
            $i = count($ex) - 1;
            while ($i >= 0) {
                $serverdnsArray[] = isset($temp) ? $ex[$i] . '.' . $temp : $ex[$i];
                $i--;
            }
        }
        if (isset($defaultdns) and $dns == $defaultdns) {
            return true;
        }
        $ex = explode('.', $dns);
        $dnsPartCount = count($ex);
        $first = $ex[0];
        if (isset($partCount) and $partCount == $dnsPartCount and isid($first, 10) and ($type == 'dns' or $type == 'server' and $first != $id)) {
            return false;
        }
        $ex = explode('-', $first);
        if ($type == 'dns' and isset($partCount) and $partCount == $dnsPartCount and $ex[0] != $id) {
            return false;
        }
        $serverdnsArray = array_unique($serverdnsArray);
        if ((isset($defaultdns) and $dns != $defaultdns or !isset($defaultdns)) and in_array($dns, $serverdnsArray)) {
            return false;
        }
    }
    return true;
}
Пример #6
0
                             if (isset($removelist)) {
                                 $connection->AdminPermissions($localserverid, 'del', $removelist);
                             }
                             if ($usedns == 'Y') {
                                 $template_file = tsdns('md', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip, $oldip), array($port, $oldport), array($dns, $olddns), $row2['resellerID']);
                             }
                             if ($row3['active'] == 'N' or $extraData->newActive == 'N') {
                                 $connection->StopServer($localserverid);
                             }
                             $query3 = $sql->prepare("UPDATE `jobs` SET `status`='3' WHERE `jobID`=? AND `type`='vo' LIMIT 1");
                             $query3->execute(array($row2['jobID']));
                             $query3 = $sql->prepare("UPDATE `voice_server` SET `jobPending`='N' WHERE `id`=? LIMIT 1");
                             $query3->execute(array($row2['affectedID']));
                         }
                     } else {
                         if (!isset($localserverid) or !isid($localserverid, 30)) {
                             $command = 'Error: can not find voiceserver';
                             $query3 = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `jobID`=? AND `type`='vo' LIMIT 1");
                             $query3->execute(array($row2['jobID']));
                         } else {
                             $command = 'Error: unknown command';
                         }
                     }
                 }
             }
             $theOutput->printGraph($command);
         }
         $connection->CloseConnection();
     }
 } else {
     $query2 = $sql->prepare("SELECT * FROM `jobs` WHERE (`status` IS NULL OR `status`='1') AND `type`='vo' AND `hostID`=?");
Пример #7
0
 $addedby = $row2['addedby'];
 $queryport = $row2['queryport'];
 $querypassword = $row2['decryptedquerypassword'];
 $resellerid = $row2['resellerid'];
 $autorestart = $row2['autorestart'];
 if ($addedby == 2) {
     $queryip = $row2['ssh2ip'];
 } else {
     if ($addedby == 1) {
         $query3 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
         $query3->execute(array($row2['rootid'], $resellerid));
         $queryip = $query3->fetchColumn();
     }
 }
 $tsdnsExternalActive = false;
 if (isid($row2['tsdnsServerID'], 19)) {
     $query3 = $sql->prepare("SELECT `id` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=? LIMIT 1");
     $query3->execute(array($row2['tsdnsServerID']));
     if ($query3->rowCount() > 0) {
         $tsdnsExternalActive = true;
     }
 }
 $split_config = preg_split('/\\//', $row2['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
 $folderfilecount = count($split_config) - 1;
 $i = 0;
 $folders = substr($row2['serverdir'], 0, 1) == '/' ? 'cd  /' : 'cd ';
 while ($i <= $folderfilecount) {
     $folders = $folders . $split_config[$i] . '/';
     $i++;
 }
 $folders = $folders == 'cd ' ? '' : $folders . ' && ';
Пример #8
0
 flush();
 # MySQL table sizes
 if ($checkTypeOfServer == 'all' or $checkTypeOfServer == 'my') {
     $query = $sql->prepare("SELECT `id`,`ip`,`port`,`user`,AES_DECRYPT(`password`,?) AS `decryptedpassword` FROM `mysql_external_servers` WHERE `active`='Y'");
     $query2 = $sql->prepare("SELECT `id` FROM `mysql_external_dbs` WHERE `sid`=? AND `dbname`=? LIMIT 1");
     $query3 = $sql->prepare("UPDATE `mysql_external_dbs` SET `dbSize`=? WHERE `id`=? LIMIT 1");
     $query->execute(array($aeskey));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $remotesql = new ExternalSQL($row['ip'], $row['port'], $row['user'], $row['decryptedpassword']);
         if ($remotesql->error == 'ok') {
             $list = $remotesql->getDBSizeList();
             if (is_array($list)) {
                 foreach ($list as $db) {
                     $query2->execute(array($row['id'], $db['dbName']));
                     $dbID = $query2->fetchColumn();
                     if (isid($dbID, 10)) {
                         echo 'Found DB ' . $db['dbName'] . ' with size ' . $db['dbSize'] . "\r\n";
                         $query3->execute(array(round($db['dbSize']), $dbID));
                     } else {
                         echo 'Cannot find DB ' . $db['dbName'] . ' with size ' . $db['dbSize'] . "\r\n";
                     }
                 }
             } else {
                 echo 'Error getting DB list for DB Server ' . $row['ip'] . ':' . $row['port'] . ': ' . $list . "\r\n";
             }
         } else {
             echo 'Error connecting to DB Server ' . $row['ip'] . ':' . $row['port'] . ': ' . $remotesql->error . "\r\n";
         }
     }
 }
 flush();
Пример #9
0
 * Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
 * OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
 * Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
 * Siehe die GNU General Public License fuer weitere Details.
 *
 * Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
 * Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
 */
if (!isset($page_include)) {
    header('Location: index.php');
    die;
}
if (isset($page_name) and isid($page_name, 10)) {
    $downloadID = (int) $page_name;
} else {
    if (isset($page_count) and isid($page_count, 10)) {
        $downloadID = (int) $page_count;
    } else {
        if ($ui->id('id', 10, 'get')) {
            $downloadID = $ui->id('id', 10, 'get');
        }
    }
}
if (isset($page_name) and $page_name == 'get' or $ui->smallletters('action', 3, 'get') == 'get') {
    $startDownload = true;
}
if (isset($downloadID)) {
    $query = $sql->prepare("SELECT d.*,t.`text` FROM `page_downloads` d LEFT JOIN `translations` t ON t.`type`='pd' AND t.`transID`=d.`fileID` AND t.`lang`=? WHERE d.`fileID`=? LIMIT 1");
    $query->execute(array($user_language, $downloadID));
    while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
        if (($row['show'] == 'E' or $row['show'] == 'A' and isset($admin_id) or $row['show'] == 'R' and (isset($user_id) or isset($admin_id))) and file_exists(EASYWIDIR . "/downloads/{$row['fileID']}.{$row['fileExtension']}")) {
Пример #10
0
 if (!isid($ui->post['cores'], 1)) {
     $fail = 1;
 } else {
     $cores = $ui->post['cores'];
 }
 if (!isid($ui->post['minmhz'], "5") and $ui->post['minmhz'] != 0) {
     $fail = 1;
     $template_file .= "MinMHZ";
 } else {
     $minmhz = $ui->post['minmhz'];
 }
 if (!isid($ui->post['maxmhz'], "5")) {
     $fail = 1;
     $template_file .= "MAXMHZ";
 }
 if (!isid($ui->post['hddsize'], 4)) {
     $fail = 1;
     $template_file .= "HDDsize";
 }
 if (!isinteger($ui->post['ram'])) {
     $fail = 1;
     $template_file .= "Ram";
 }
 if (!isinteger($ui->post['minram'])) {
     $fail = 1;
     $template_file .= "MinRam";
 } else {
     $minram = $ui->post['minram'];
 }
 if (!isinteger($ui->post['maxram'])) {
     $fail = 1;
Пример #11
0
 * Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
 * Siehe die GNU General Public License fuer weitere Details.
 *
 * Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
 * Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
 */
if (!defined('AJAXINCLUDED')) {
    die('Do not access directly!');
}
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `webVhost` WHERE `resellerID`=?");
$query->execute(array($resellerLockupID));
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
    $userInQuery = count($userIDs) > 0 ? ' OR `userID` IN (' . implode(',', $userIDs) . ')' : '';
    $toLower = strtolower($sSearch);
    if (strpos('web-', $toLower) !== false or isid(str_replace('web-', '', $toLower), 10)) {
        $sSearch = preg_replace('/[a-zA-Z\\-]/', '', $sSearch);
    }
    $statusQuery = array();
    if (strpos(strtolower($gsprache->status_inactive), $toLower) !== false or strpos(strtolower($gsprache->status_stop), $toLower) !== false) {
        $statusQuery[] = "OR v.`active`='N'";
    }
    if (strpos(strtolower($gsprache->status_ok), $toLower) !== false) {
        $statusQuery[] = "OR v.`active`='Y'";
    }
    $statusQuery = count($statusQuery) > 0 ? implode(' ', $statusQuery) : '';
    $query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `webVhost` AS v LEFT JOIN `userdata` AS u ON v.`userID`=u.`id` WHERE v.`resellerID`=:reseller_id AND (v.`webVhostID` LIKE :search OR v.`description` LIKE :search {$userInQuery} {$statusQuery})");
    $query->execute(array(':search' => '%' . $sSearch . '%', ':reseller_id' => $resellerLockupID));
    $array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
    $array['iTotalDisplayRecords'] = $array['iTotalRecords'];
Пример #12
0
         if ($substituteImported === true and isid($belongsToLocalID, 11)) {
             $serverAccess = (array) $value->serverAccess;
             foreach ($serverAccess['gs'] as $externalGsID) {
                 $query6->execute(array(json_encode(array('I' => $row['importID'])), $externalGsID, $belongsToLocalID, $resellerID));
                 $localGsID = $query6->fetchColumn();
                 if (isid($localGsID, 10)) {
                     $query7->execute(array($localID, $localGsID, $resellerID));
                     printText('Imported substitute gameserver server access. Local gameserverid is: ' . $localGsID);
                 } else {
                     printText('Error: Importing substitute gameserver server access. No local gameserver');
                 }
             }
             foreach ($serverAccess['vo'] as $externalVoID) {
                 $query8->execute(array(json_encode(array('I' => $row['importID'])), $externalVoID, $belongsToLocalID, $resellerID));
                 $localVoID = $query8->fetchColumn();
                 if (isid($localVoID, 10)) {
                     $query9->execute(array($localID, $localVoID, $resellerID));
                     printText('Imported substitute gameserver server access. Local gameserverid is: ' . $localVoID);
                 } else {
                     printText('Error: Importing substitute gameserver server access. No local voiceserver');
                 }
             }
         }
     }
 }
 if ($left > 0) {
     printText('Total amount is: ' . $decoded->total . ' substitutes left: ' . $left . ' need to make another run');
     sleep(1);
 } else {
     printText('Total amount is: ' . $decoded->total . ' No substitute left.');
 }
Пример #13
0
 }
 $ips = array();
 $ports = array();
 $addresses = array();
 $words = array();
 $ids = array();
 $adIDs = array();
 $gsIDs = array();
 $imIDs = array();
 $roIDs = array();
 $usIDs = array();
 $voIDs = array();
 $vsIDs = array();
 foreach (preg_split("/\\s/", $ui->get['q'], -1, PREG_SPLIT_NO_EMPTY) as $s) {
     switch ($s) {
         case isid($s, 19):
             $ids[] = $s;
             $q[] = $s;
             if (port($s)) {
                 $ports[] = $s;
             }
             break;
         case isip($s, 'all'):
             $ips[] = $s;
             $q[] = $s;
             break;
         case ipport($s):
             $addresses[] = $s;
             list($ips[], $ports[]) = explode(':', preg_replace('/\\s+/', '', $s));
             $q[] = $s;
             break;
Пример #14
0
 public function channelList($virtualserver_id)
 {
     $this->StartServer($virtualserver_id);
     $useserver = $this->UseServer($virtualserver_id);
     if (isset($useserver[0]['msg']) and strtolower($useserver[0]['msg']) == 'ok') {
         $channels = array();
         $channelList = $this->SendCommand('channellist');
         if (is_array($channelList)) {
             foreach ($channelList as $channel) {
                 if (isset($channel['cid']) and isid($channel['cid'], 30)) {
                     $props = $this->SendCommand('channelinfo cid=' . $channel['cid']);
                     if (isset($props[0]['channel_name'])) {
                         $channels[$this->ReplaceFromTS3($props[0]['channel_name'])] = $this->ReplaceFromTS3($props[0]['channel_filepath']);
                     }
                 }
             }
         }
         $return = json_encode($channels);
     } else {
         $return = $useserver;
     }
     return $return;
 }
Пример #15
0
         $errors['publickey'] = $sprache->keyuse;
         if ($publickey == 'N') {
             $errors['pass'] = $sprache->ssh_pass;
         } else {
             if (!$ui->active('publickey', 'post') == 'B') {
                 $errors['pass'] = $sprache->ssh_pass;
                 $errors['keyname'] = $sprache->keyname;
             } else {
                 $errors['keyname'] = $sprache->keyname;
             }
         }
     }
 }
 if (count($errors) == 0) {
     if ($ui->st('action', 'post') == 'ad' and $reseller_id == 0) {
         $insertOwner = isid($ownerID, 10) ? $ownerID : 0;
         $query = $sql->prepare("INSERT INTO `rserverdata` (`config_log_time`,`config_demo_time`,`config_ztmp_time`,`config_bad_time`,`config_user_id`,`config_ionice`,`config_binaries`,`config_files`,`config_bad_files`,`active`,`steamAccount`,`steamPassword`,`hyperthreading`,`cores`,`ip`,`altips`,`port`,`user`,`pass`,`os`,`bitversion`,`description`,`ftpport`,`publickey`,`keyname`,`maxslots`,`maxserver`,`updates`,`updateMinute`,`ram`,`connect_ip_only`,`install_paths`,`quota_active`,`quota_cmd`,`repquota_cmd`,`blocksize`,`inode_block_ratio`,`externalID`,`resellerid`) VALUES (:configLogTime,:configDemoTime,:configZtmpTime,:configBadTime,:configUserID,:configIonice,:configBinaries,:configFiles,:configBadFiles,:active,AES_ENCRYPT(:steamAccount,:aeskey),AES_ENCRYPT(:steamPassword,:aeskey),:hyperthreading,:cores,:ip,:altips,AES_ENCRYPT(:port,:aeskey),AES_ENCRYPT(:user,:aeskey),AES_ENCRYPT(:pass,:aeskey),:os,:bit,:desc,:ftpport,:publickey,:keyname,:maxslots,:maxserver,:updates,:updateMinute,:ram,:connect_ip_only,:install_paths,:quota_active,:quota_cmd,:repquota_cmd,:blocksize,:inode_block_ratio,:externalID,:reseller)");
         $query->execute(array(':configLogTime' => $configLogTime, ':configDemoTime' => $configDemoTime, ':configZtmpTime' => $configZtmpTime, ':configBadTime' => $configBadTime, ':configUserID' => $configUserID, ':configIonice' => $configIonice, ':configBinaries' => $configBinaries, ':configFiles' => $configFiles, ':configBadFiles' => $configBadFiles, ':active' => $active, ':steamAccount' => $steamAccount, ':steamPassword' => $steamPassword, ':hyperthreading' => $hyperthreading, ':cores' => $cores, ':ip' => $ip, ':altips' => $altips, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':bit' => $bit, ':desc' => $desc, ':ftpport' => $ftpport, ':publickey' => $publickey, ':keyname' => $keyname, ':maxslots' => $maxslots, ':maxserver' => $maxserver, ':updates' => $updates, ':updateMinute' => $updateMinute, ':ram' => $ram, ':connect_ip_only' => $connectIpOnly, ':install_paths' => $installPaths, ':quota_active' => $quotaActive, ':quota_cmd' => $quotaCmd, ':repquota_cmd' => $repquotaCmd, ':blocksize' => $blocksize, ':inode_block_ratio' => $inodeBlockRatio, ':externalID' => $externalID, ':reseller' => $ownerID));
         $rowCount = $query->rowCount();
         $loguseraction = '%add% %root% ' . $ip;
     } else {
         if ($ui->st('action', 'post') == 'md') {
             if ($reseller_id == 0) {
                 $query = $sql->prepare("UPDATE `rserverdata` SET `config_log_time`=:configLogTime,`config_demo_time`=:configDemoTime,`config_ztmp_time`=:configZtmpTime,`config_bad_time`=:configBadTime,`config_user_id`=:configUserID,`config_ionice`=:configIonice,`config_binaries`=:configBinaries,`config_files`=:configFiles,`config_bad_files`=:configBadFiles,`active`=:active,`steamAccount`=AES_ENCRYPT(:steamAccount,:aeskey),`steamPassword`=AES_ENCRYPT(:steamPassword,:aeskey),`hyperthreading`=:hyperthreading,`cores`=:cores,`ip`=:ip,`altips`=:altips,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user, :aeskey),`pass`=AES_ENCRYPT(:pass, :aeskey),`os`=:os,`bitversion`=:bit,`description`=:desc,`ftpport`=:ftpport,`publickey`=:publickey,`keyname`=:keyname,`maxslots`=:maxslots,`maxserver`=:maxserver,`updates`=:updates,`updateMinute`=:updateMinute,`ram`=:ram,`connect_ip_only`=:connect_ip_only,`install_paths`=:install_paths,`quota_active`=:quota_active,`quota_cmd`=:quota_cmd,`repquota_cmd`=:repquota_cmd,`blocksize`=:blocksize,`inode_block_ratio`=:inode_block_ratio,`externalID`=:externalID,`resellerid`=:reseller_id WHERE `id`=:id LIMIT 1");
                 $query->execute(array(':configLogTime' => $configLogTime, ':configDemoTime' => $configDemoTime, ':configZtmpTime' => $configZtmpTime, ':configBadTime' => $configBadTime, ':configUserID' => $configUserID, ':configIonice' => $configIonice, ':configBinaries' => $configBinaries, ':configFiles' => $configFiles, ':configBadFiles' => $configBadFiles, ':active' => $active, ':steamAccount' => $steamAccount, ':steamPassword' => $steamPassword, ':hyperthreading' => $hyperthreading, ':cores' => $cores, ':ip' => $ip, ':altips' => $altips, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':bit' => $bit, ':desc' => $desc, ':publickey' => $publickey, ':ftpport' => $ftpport, ':keyname' => $keyname, ':maxslots' => $maxslots, ':maxserver' => $maxserver, ':updates' => $updates, ':updateMinute' => $updateMinute, ':ram' => $ram, ':connect_ip_only' => $connectIpOnly, ':install_paths' => $installPaths, ':quota_active' => $quotaActive, ':quota_cmd' => $quotaCmd, ':repquota_cmd' => $repquotaCmd, ':blocksize' => $blocksize, ':inode_block_ratio' => $inodeBlockRatio, ':externalID' => $externalID, ':reseller_id' => $ownerID, ':id' => $id));
             } else {
                 $query = $sql->prepare("UPDATE `rserverdata` AS r SET `config_log_time`=:configLogTime,`config_demo_time`=:configDemoTime,`config_ztmp_time`=:configZtmpTime,`config_bad_time`=:configBadTime,`config_user_id`=:configUserID,`config_ionice`=:configIonice,`config_binaries`=:configBinaries,`config_files`=:configFiles,`config_bad_files`=:configBadFiles,`active`=:active,`steamAccount`=AES_ENCRYPT(:steamAccount,:aeskey),`steamPassword`=AES_ENCRYPT(:steamPassword,:aeskey),`hyperthreading`=:hyperthreading,`cores`=:cores,`ip`=:ip,`altips`=:altips,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user, :aeskey),`pass`=AES_ENCRYPT(:pass, :aeskey),`os`=:os,`bitversion`=:bit,`description`=:desc,`ftpport`=:ftpport,`publickey`=:publickey,`keyname`=:keyname,`maxslots`=:maxslots,`maxserver`=:maxserver,`updates`=:updates,`updateMinute`=:updateMinute,`ram`=:ram,`connect_ip_only`=:connect_ip_only,`install_paths`=:install_paths,`quota_active`=:quota_active,`quota_cmd`=:quota_cmd,`repquota_cmd`=:repquota_cmd,`blocksize`=:blocksize,`inode_block_ratio`=:inode_block_ratio,`externalID`=:externalID,`resellerid`=:ownerID WHERE `id`=:id AND (`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)) LIMIT 1");
                 $query->execute(array(':configLogTime' => $configLogTime, ':configDemoTime' => $configDemoTime, ':configZtmpTime' => $configZtmpTime, ':configBadTime' => $configBadTime, ':configUserID' => $configUserID, ':configIonice' => $configIonice, ':configBinaries' => $configBinaries, ':configFiles' => $configFiles, ':configBadFiles' => $configBadFiles, ':active' => $active, ':steamAccount' => $steamAccount, ':steamPassword' => $steamPassword, ':hyperthreading' => $hyperthreading, ':cores' => $cores, ':ip' => $ip, ':altips' => $altips, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':bit' => $bit, ':desc' => $desc, ':publickey' => $publickey, ':ftpport' => $ftpport, ':keyname' => $keyname, ':maxslots' => $maxslots, ':maxserver' => $maxserver, ':updates' => $updates, ':updateMinute' => $updateMinute, ':ram' => $ram, ':connect_ip_only' => $connectIpOnly, ':install_paths' => $installPaths, ':quota_active' => $quotaActive, ':quota_cmd' => $quotaCmd, ':repquota_cmd' => $repquotaCmd, ':blocksize' => $blocksize, ':inode_block_ratio' => $inodeBlockRatio, ':externalID' => $externalID, ':ownerID' => $ownerID, ':id' => $id, ':reseller_id' => $resellerLockupID));
             }
             $rowCount = $query->rowCount();
             $loguseraction = '%mod% %root% ' . $ip;
Пример #16
0
     }
 }
 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();
     tsbackup('delete', $ssh2user, $serverdir, $rootID, $localserverid, '*');
     $template_file = $spracheResponse->table_del;
     $loguseraction = '%del% %voserver% ' . $ip . ':' . $port;
     $insertlog->execute();
     if (isset($usedns) and $usedns == 'Y') {
         if (isset($tsdnsServerID) and isid($tsdnsServerID, 10)) {
             $query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND (`resellerid`=:reseller_id OR `managedForID`=:managedForID) LIMIT 1");
             $query->execute(array(':aeskey' => $aeskey, ':id' => $tsdnsServerID, ':reseller_id' => $resellerLockupID, ':managedForID' => $admin_id));
             while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                 $publickey = $row['publickey'];
                 $queryip = $row['ssh2ip'];
                 $ssh2port = $row['decryptedssh2port'];
                 $ssh2user = $row['decryptedssh2user'];
                 $ssh2password = $row['decryptedssh2password'];
                 $serverdir = $row['serverdir'];
                 $keyname = $row['keyname'];
                 $bitversion = $row['bitversion'];
             }
         }
         tsdns('dl', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip), array($port), array($dns), $resellerLockupID);
     }
Пример #17
0
$query->execute();
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
    $registration = $row['registration'];
    $registrationQuestion = $row['registrationQuestion'];
    $registrationBadEmail = $row['registrationBadEmail'];
    $registrationBadIP = $row['registrationBadIP'];
}
$langObject = getlanguagefile('user', $user_language, 0);
if (isset($registration) and in_array($registration, array('A', 'M', 'D'))) {
    $activationToken = (isset($page_name) and isset($page_count) and $page_name == 'activate' and wpreg_check($page_count, 100)) ? $page_count : $ui->pregw('activate', 100, 'get');
    if ($activationToken) {
        // Check if a user to the activation ID exists
        $query = $sql->prepare("SELECT `id` FROM `userdata` WHERE `token`=? LIMIT 1");
        $query->execute(array($activationToken));
        $userID = $query->fetchColumn();
        if (isid($userID, 10)) {
            $query = $sql->prepare("UPDATE `userdata` SET `active`='Y',`token`=null,`updateTime`=NOW() WHERE `id`=? LIMIT 1");
            $query->execute(array($userID));
            $_SESSION['userid'] = $userID;
            $_SESSION['resellerid'] = 0;
            $template_file = $page_sprache->registerActivated;
            $langObjectTemp = getlanguagefile('redirect', $user_language, 0);
            $text = $langObjectTemp->refresh;
            $langObjectTemp = null;
            if (isset($page_data->canurl)) {
                $header = '<meta http-equiv="refresh" content="3; URL=' . $page_data->canurl . '">';
            } else {
                $header = '<meta http-equiv="refresh" content="3; URL=/">';
            }
        } else {
            $template_file = $page_sprache->registerErrorActivatedFailed;
Пример #18
0
         $query = $sql->prepare("SELECT 1 FROM `userdata` WHERE `id`=? AND `resellerid`=? AND `accounttype`='u' LIMIT 1");
         $query->execute(array($userID, $resellerLockupID));
         if ($query->rowCount() == 0) {
             $errors['userID'] = $sprache->user;
         }
     }
 }
 if ($ui->st('action', 'post') == 'md') {
     $query = $sql->prepare("SELECT `sid`,`uid` FROM `mysql_external_dbs` WHERE `id`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($id, $resellerLockupID));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $rootID = $row['sid'];
         $userID = $row['uid'];
     }
 }
 if (!isid($rootID, 10)) {
     $errors['rootID'] = 'MySQL Server';
 } else {
     $query = $sql->prepare("SELECT `ip`,`port`,`user`,AES_DECRYPT(`password`,?) AS `decryptedpassword`,CASE WHEN `connect_ip_only`='Y' THEN `external_address` ELSE `ip` END AS `user_connect_ip` FROM `mysql_external_servers` WHERE `id`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($aeskey, $rootID, $reseller_id));
     foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $mysqlServer) {
         $mysqlServerFount = true;
     }
     if (!isset($mysqlServerFount)) {
         $errors['rootID'] = 'MySQL Server';
     }
 }
 $rowCount = 0;
 if (count($errors) == 0 and isset($mysqlServer)) {
     if ($ui->st('action', 'post') == 'ad') {
         $query = $sql->prepare("INSERT INTO `mysql_external_dbs` (`externalID`,`active`,`sid`,`uid`,`description`,`password`,`ips`,`manage_host_table`,`max_queries_per_hour`,`max_updates_per_hour`,`max_connections_per_hour`,`max_userconnections_per_hour`,`resellerid`) VALUES (?,?,?,?,?,AES_ENCRYPT(?,?),?,?,?,?,?,?,?)");
Пример #19
0
 $adid = $row2['addon_id'];
 $depending = $row2['depending'];
 $menudescription = $row2['menudescription'];
 $query3 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
 $query3->execute(array($adid, $user_language, $resellerLockupID));
 $descriptionrow = $query3->fetchColumn();
 if (empty($descriptionrow)) {
     $query3 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='ad' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
     $query3->execute(array($adid, $rSA['language'], $resellerLockupID));
     $descriptionrow = $query->fetchColumn();
 }
 $addescription = nl2br($descriptionrow);
 $query3 = $protected == 'Y' ? $sql->prepare("SELECT `id` FROM `addons_installed` WHERE `userid`=? AND `serverid`=? AND `addonid`=? AND `servertemplate`=? AND `paddon`='Y' AND `resellerid`=? LIMIT 1") : $sql->prepare("SELECT `id` FROM `addons_installed` WHERE `userid`=? AND `serverid`=? AND `addonid`=? AND `servertemplate`=? AND `resellerid`=? LIMIT 1");
 $query3->execute(array($user_id, $serverid, $adid, $servertemplate, $resellerLockupID));
 $installedid = $query3->fetchColumn();
 if (isid($installedid, 10)) {
     $action = 'dl';
     $delete = '&amp;rid=' . $installedid;
 } else {
     $query3 = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `addons_installed` WHERE `userid`=? AND `serverid`=? AND `servertemplate`=? AND `addonid`=? AND `resellerid`=? LIMIT 1");
     $query3->execute(array($user_id, $serverid, $servertemplate, $depending, $resellerLockupID));
     $colcount = $query3->fetchColumn();
     if ($row2['type'] == 'map' or $depending == 0 or $depending > 0 and $colcount > 0) {
         $action = 'ad';
     } else {
         $action = 'none';
         $query3 = $sql->prepare("SELECT `menudescription` FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
         $query3->execute(array($depending, $resellerLockupID));
         $imgAlt = $sprache->requires . ': ' . $query3->fetchColumn();
     }
 }
Пример #20
0
 $fail = 0;
 $error = 'Error:';
 if ($ui->id('xml', 1, 'post') == 1) {
     $password = $xml->password;
     $slots = (int) $xml->slots;
     $lendtime = (int) $xml->lendtime;
 } else {
     $password = $ui->w('password', 50, 'post');
     $slots = $ui->id('slots', 3, 'post');
     $lendtime = $ui->id('time', 4, 'post');
 }
 if (!isid($slots, 3) or $slots > $vomaxplayer or $slots < $vominplayer) {
     $fail = 1;
     $error .= 'Slots</br>';
 }
 if (!isid($lendtime, 4) or $lendtime > $vomaxtime or $lendtime < $vomintime) {
     $fail = 1;
     $error .= 'Time' . "{$lendtime} > {$vomaxtime} or {$lendtime} < {$vomintime}" . '</br>';
 }
 if (!wpreg_check($password, 50)) {
     $error .= 'Password</br>';
     $fail = 1;
 }
 if ($fail == 0 and $freevoice > 0) {
     $timeleft = $lendtime;
     $query = $sql->prepare("SELECT `bitversion`,`type`,`queryport`,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,`rootid`,`addedby`,`publickey`,`ssh2ip`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password`,`serverdir`,`keyname`,`notified`,`defaultname`,`defaultwelcome`,`defaulthostbanner_url`,`defaulthostbanner_gfx_url`,`defaulthostbutton_tooltip`,`defaulthostbutton_url`,`defaulthostbutton_gfx_url`,`usedns` FROM `voice_masterserver` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
     $query->execute(array(':aeskey' => $aeskey, ':id' => $bestmaster, ':reseller_id' => $reseller_id));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $addedby = $row['addedby'];
         $queryport = $row['queryport'];
         $querypassword = $row['decryptedquerypassword'];
Пример #21
0
             $query->execute(array($localID, $resellerID));
             $query = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='vo' AND (`status` IS NULL OR `status`='1') AND `affectedID`=? and `resellerID`=?");
             $query->execute(array($localID, $resellerID));
             $query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`resellerid`) VALUES ('A','vo',?,?,?,?,?,NULL,NOW(),'dl',?)");
             $query->execute(array($hostID, $resellerID, $localID, $userID, $name, $resellerID));
         } else {
             $success['false'][] = 'No server can be found to delete';
         }
     } else {
         $success['false'][] = 'No data for this method';
     }
 } else {
     if (!isset($success['false']) and array_value_exists('action', 'ls', $data) and isset($data['identify_server_by']) and dataExist('identify_server_by', $data)) {
         $from = array('server_local_id' => 'id', 'server_external_id' => 'externalID');
         $identifyServerBy = $data['identify_server_by'];
         $localServerID = isid($data['server_local_id'], 10);
         $externalServerID = isExternalID($data['server_external_id']);
         $list = true;
         $query = $sql->prepare("SELECT * FROM `voice_server` WHERE `" . $from[$data['identify_server_by']] . "`=? AND `resellerid`=? LIMIT 1");
         $query->execute(array($data[$data['identify_server_by']], $resellerID));
         if ($apiType == 'xml') {
             header("Content-type: text/xml; charset=UTF-8");
             $responsexml = new DOMDocument('1.0', 'utf-8');
             $element = $responsexml->createElement('voice');
             while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                 foreach ($row as $k => $v) {
                     $server = $responsexml->createElement($k, $v);
                     $element->appendChild($server);
                 }
             }
             $responsexml->appendChild($element);
Пример #22
0
             if (isset($removelist)) {
                 $connection->AdminPermissions($virtualserver_id, 'del', $removelist);
             }
             $connection->ImportModServer($virtualserver_id, $slots, $TSDNSSsh2ip, $port, $settings);
             $added .= 'Server ' . $ssh2ip . ':' . $port . '<br />';
             $query = $sql->prepare("INSERT INTO `voice_server` (`userid`,`masterserver`,`ip`,`port`,`slots`,`password`,`forcebanner`,`forcebutton`,`forceservertag`,`forcewelcome`,`dns`,`flexSlots`,`flexSlotsFree`,`flexSlotsPercent`,`localserverid`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
             $query->execute(array($customerID, $masterid, $TSDNSSsh2ip, $port, $slots, $password, $forcebanner, $forcebutton, $forceservertag, $forcewelcome, $serverdns, $flexSlots, $flexSlotsFree, $flexSlotsPercent, $virtualserver_id, $reseller_id));
         }
         $i++;
     }
 }
 $not = '';
 $connection->CloseConnection();
 if ($usedns == 'Y') {
     $dns = array();
     if (isid($tsdnsServerID, 19)) {
         $query = $sql->prepare("SELECT `id` FROM `voice_masterserver` WHERE `tsdnsServerID`=? AND `resellerid`=?");
         $query2 = $sql->prepare("SELECT `ip`,`port`,`dns` FROM `voice_server` WHERE `masterserver`=? AND `resellerid`=?");
         $query->execute(array($tsdnsServerID, $reseller_id));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $query2->execute(array($row['id'], $reseller_id));
             while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
                 $dns[] = $row2['dns'] . '=' . $row2['ip'] . ':' . $row2['port'];
             }
         }
     } else {
         $query = $sql->prepare("SELECT `ip`,`port`,`dns` FROM `voice_server` WHERE `masterserver`=? AND `resellerid`=?");
         $query->execute(array($masterid, $reseller_id));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $dns[] = $row['dns'] . '=' . $row['ip'] . ':' . $row['port'];
         }
Пример #23
0
                 $state = $row['state'];
             }
             if (isset($state) and $state != 'C' and $ui->w('state', 1, 'post') != 'C') {
                 $affectedRows = 0;
                 if ($ui->id('priority', 1, 'post')) {
                     $query = $sql->prepare("UPDATE `tickets` SET `state`=?,`supporter`=?,`priority`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
                     $query->execute(array($ui->w('state', 1, 'post'), $ui->id('supporter', 10, 'post'), $ui->id('priority', 1, 'post'), $id, $resellerLockupID));
                     $affectedRows += $query->rowCount();
                 }
                 if (isset($ui->post['ticket']) and strlen($ui->post['ticket']) > 0) {
                     $query = $sql->prepare("INSERT INTO `tickets_text` (`ticketID`,`message`,`writeDate`,`userID`,`resellerid`) VALUES (?,?,?,?,?)");
                     $query->execute(array($id, $ui->post['ticket'], $logdate, $admin_id, $resellerLockupID));
                     $affectedRows += $query->rowCount();
                 }
                 $template_file = $affectedRows > 0 ? $spracheResponse->table_add : $spracheResponse->error_table;
                 if (isid($userid, 10)) {
                     $query = $sql->prepare("SELECT `mail_ticket` FROM `userdata` WHERE `id`=? LIMIT 1");
                     $query->execute(array($userid));
                     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                         if ($row['mail_ticket'] == 'Y') {
                             sendmail('emailnewticket', $userid, $ui->post['ticket'], array($id, $admin_id));
                         }
                     }
                 }
             } else {
                 $template_file = 'userpanel_404.tpl';
             }
         }
     }
 } else {
     $table = array();
Пример #24
0
     if ($reseller_id == 0) {
         $pselect = $sql->prepare("SELECT `cname` FROM `userdata` WHERE `accounttype`='r' AND `id`=:id LIMIT 1");
         $pselect->execute(array(':id' => $ui->post['what']));
     } else {
         if ($reseller_id == $admin_id) {
             $pselect = $sql->prepare("SELECT `cname` FROM `userdata` WHERE `accounttype`='r' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
             $pselect->execute(array(':id' => $ui->post['what'], ':reseller_id' => $reseller_id));
         }
     }
     foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
         $display = $extra . '  ' . $row['cname'];
     }
 } else {
     if ($ui->post['kind'] == "se") {
         $kind = "se";
         if (isid($ui->post['what'], '30')) {
             $whichdata = "&amp;shorten=" . $ui->post['what'];
         }
         if ($reseller_id == 0) {
             $pselect = $sql->prepare("SELECT u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`id`=:id ORDER BY u.`id`,c.`id` LIMIT 1");
             $pselect->execute(array(':id' => $ui->post['what']));
         } else {
             if ($reseller_id == $admin_id) {
                 $pselect = $sql->prepare("SELECT u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`id`=:id  AND c.`resellerid`=:reseller_id ORDER BY u.`id`,c.`id` LIMIT 1");
                 $pselect->execute(array(':id' => $ui->post['what'], ':reseller_id' => $reseller_id));
             } else {
                 $pselect = $sql->prepare("SELECT u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`id`=:id  AND c.`userid`=:admin_id AND c.`resellerid`=:reseller_id ORDER BY u.`id`,c.`id` LIMIT 1");
                 $pselect->execute(array(':id' => $ui->post['what'], ':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
             }
         }
         foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
Пример #25
0
     $query4 = $sql->prepare("INSERT INTO `page_terms_used` (`page_id`,`term_id`,`language_id`,`resellerid`) VALUES (?,?,?,?)");
     $rowCount += (int) $query->rowCount();
     foreach ($addterms as $lg => $terms) {
         foreach ($terms as $term) {
             if (isset($term['word'])) {
                 $query->execute(array($lg, $term['word'], $resellerLockupID));
                 $term_id = $query->fetchColumn();
                 if (isid($term_id, 19)) {
                     $query2->execute(array($term_id, $resellerLockupID));
                     $rowCount += $query2->rowCount();
                 } else {
                     $query3->execute(array($lg, $term['word'], strtolower(szrp($term['word'])), $resellerLockupID));
                     $rowCount += $query3->rowCount();
                     $term_id = $sql->lastInsertId();
                 }
                 if (isid($term_id, 19)) {
                     $query4->execute(array($id, $term_id, $term['lid'], $resellerLockupID));
                     $rowCount += (int) $query4->rowCount();
                 }
             }
         }
     }
 } else {
     $query = $sql->prepare("SELECT t.`name` FROM `page_terms_used` u LEFT JOIN `page_terms` t ON u.`term_id`=t.`id` WHERE u.`page_id`=? AND u.`resellerid`=?");
     $query->execute(array($id, $resellerLockupID));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $countreduce[] = $row['name'];
     }
     $query = $sql->prepare("DELETE FROM `page_page` WHERE `id`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($id, $resellerLockupID));
     $rowCount += (int) $query->rowCount();
Пример #26
0
            }
        }
    }
    if (isset($page_lookupid)) {
        $query = $sql->prepare("SELECT `cname`,`name`,`vname`,`lastlogin` FROM `userdata` WHERE `id`=? LIMIT 1");
        $query->execute(array($page_lookupid));
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $great_name = $row['name'];
            $great_vname = $row['vname'];
            $great_user = ($row['name'] != '' or $row['vname'] != '') ? trim($row['vname'] . ' ' . $row['name']) : $row['cname'];
            if ($row['lastlogin'] != null and $row['lastlogin'] != '0000-00-00 00:00:00') {
                $great_last = $user_language == 'de' ? date('d.m.Y H:m:s', strtotime($row['lastlogin'])) : $row['lastlogin'];
            } else {
                $great_last = $user_language == 'de' ? 'Niemals' : 'Never';
            }
        }
    }
    if (!isset($s) and !isset($page_category) and isset($page_default) and isid($page_default, 19)) {
        $s = 'page';
        $default_page_id = $page_default;
    } else {
        if (!isset($s) and !isset($page_category) and isset($page_default)) {
            $s = $page_default;
        } else {
            if (!isset($s) and isset($page_category) and $page_category != '' and $page_category != null) {
                $s = 404;
                $throw404 = true;
            }
        }
    }
}
Пример #27
0
     $allCategories = array();
     $comments = array();
     $category_tags = array();
     $tag_tags = array();
     $template_file = isset($page_title) ? 'page_news_single.tpl' : 'page_404.tpl';
 } else {
     $news = array();
     $category_tags = array();
     $tag_tags = array();
     $allTags = array();
     $allCategories = array();
     $query = $sql->prepare("SELECT COUNT(p.`id`) AS `amount` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` WHERE p.`released`='1' AND p.`type`='news' AND t.`language`=? AND p.`resellerid`=0");
     $query->execute(array($user_language));
     $totalCount = $query->fetchColumn();
     $pagesCount = ceil($totalCount / $maxnews);
     if (isset($page_name) and $page_name == szrp($page_sprache->older) and (isset($page_count) and isid($page_count, 255)) or $ui->id('start', 255, 'get')) {
         if ($ui->id('start', 255, 'get') and $ui->id('start', 255, 'get') <= $pagesCount) {
             $pageOpen = $ui->id('start', 255, 'get');
         } else {
             if (isset($page_count) and $page_count <= $pagesCount) {
                 $pageOpen = $page_count;
             } else {
                 $pageOpen = $pagesCount;
             }
         }
         $startLooking = $pageOpen * $maxnews;
     }
     if (!isset($startLooking) or $startLooking < 0) {
         $startLooking = 0;
     }
     if (!isset($pageOpen) or $pageOpen < 0) {
Пример #28
0
     $page_data->title = $row['title'];
     $page_title = $row['title'];
     $breadcrumbID = $row['subpage'];
     $breadcrumbPageID = $page_id;
     $page_text = str_replace('%url%', $page_data->pageurl, $row['text']);
     $page_text = preg_replace_callback('/<pre.*?>(.*?)<\\/pre>/imsu', 'pre_replace', $page_text);
     $query2 = $sql->prepare("SELECT t.`name` FROM `page_terms_used` u LEFT JOIN `page_terms` t ON u.`term_id`=t.`id` WHERE u.`language_id`=? AND u.`resellerid`='0' ORDER BY t.`name` DESC");
     $query2->execute(array($row['id']));
     while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
         $page_data->AddData('keywords', $row2['name']);
         $tag_tags[] = $seo == 'Y' ? '<a href=' . $page_url . '/' . $user_language . '/' . $page_sprache->tag . '/' . strtolower(szrp($row2['name'])) . '/>' . $row2['name'] . '</a>' : '<a href=' . $page_url . '/index.php?site=tag&amp;tag=' . strtolower(szrp($row2['name'])) . '/>' . $row2['name'] . '</a>';
     }
 }
 $breadcrumbs = array();
 $query = $sql->prepare("SELECT p.`id`,p.`subpage`,t.`title` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` WHERE p.`id`=? AND t.`language`=? AND `type`='page' AND p.`released`='1' AND p.`resellerid`='0' LIMIT 1");
 while (isset($breadcrumbID) and isid($breadcrumbID, 19) and $breadcrumbID != $breadcrumbPageID) {
     $query->execute(array($breadcrumbID, $user_language));
     unset($breadcrumbID);
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $link = (isset($seo) and $seo == 'Y') ? $page_data->pageurl . '/' . $user_language . '/' . szrp($row['title']) . '/' : $page_data->pageurl . '?s=page&amp;l=' . $user_language . '&amp;id=' . $row['id'];
         $breadcrumbs[] = array('href' => '<a href="' . $link . '">' . $row['title'] . '</a>', 'link' => $link);
         $breadcrumbID = $row['subpage'];
         $breadcrumbPageID = $row['id'];
     }
 }
 $breadcrumbs = array_reverse($breadcrumbs);
 if (isset($page_title)) {
     $page_data->setCanonicalUrl('page', $page_id);
     $template_file = 'page_page.tpl';
 } else {
     $template_file = 'page_404.tpl';
Пример #29
0
    }
    $template_to_use = $rSA['template'];
    $support_phonenumber = $rSA['supportnumber'];
    $logdate = date('Y-m-d H:i:s');
}
if ($loguserip != 'localhost') {
    if (isset($_SESSION['language'])) {
        $user_language = $_SESSION['language'];
    }
    if (isset($page_include)) {
        $query = $sql->prepare("SELECT * FROM `page_settings` WHERE `resellerid`=0 LIMIT 1");
        $query->execute();
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $seo = $row['seo'];
            $rssfeed = $row['rssfeed'];
            $maxnews = isid($row['maxnews'], 11) ? $row['maxnews'] : 10;
            $page_default = $row['defaultpage'];
            $pageurl = $row['pageurl'];
            $protectioncheck = $row['protectioncheck'];
            $maxnews_sidebar = $row['maxnews_sidebar'];
            $newssidebar_textlength = $row['newssidebar_textlength'];
            $spamFilter = $row['spamFilter'];
            $languageFilter = $row['languageFilter'];
            $blockLinks = $row['blockLinks'];
            $blockWords = $row['blockWords'];
            $mailRequired = $row['mailRequired'];
            $commentMinLength = $row['commentMinLength'];
            $commentsModerated = $row['commentsModerated'];
            $honeyPotKey = $row['honeyPotKey'];
            if (!isurl($pageurl) and !isdomain($pageurl)) {
                $pageurl = $page_url;
Пример #30
0
 public function rootServer($ID, $action, $type = 'dedicated', $extraData = null)
 {
     $this->tempID = $ID;
     $this->ID[$type][$ID] = array();
     $this->ID[$type][$ID]['action'] = $action;
     $this->type = $type;
     $this->extraData = $extraData;
     $imageID = isset($extraData['imageID']) ? $extraData['imageID'] : 0;
     $hostID = 0;
     $userID = 0;
     $resellerID = 0;
     if (isid($imageID, 10)) {
         $query = $this->sql->prepare("SELECT `distro`,`bitversion` FROM `resellerimages` WHERE `id`=? AND `active`='Y' LIMIT 1");
         $query->execute(array($imageID));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $distro = $row['distro'];
             $guestos = $row['bitversion'] == '32' ? $row['distro'] : $row['distro'] . '-' . $row['bitversion'];
         }
     }
     // get Root Data from DB
     if ($this->type == 'dedicated') {
         $query = $this->sql->prepare("SELECT d.*,u.`cname` FROM `rootsDedicated` d LEFT JOIN `userdata` u ON d.`userID`=u.`id` WHERE d.`dedicatedID`=? LIMIT 1");
         $query->execute(array($this->tempID));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $this->ID[$type][$ID]['useDHCP'] = $row['useDHCP'];
             $this->ID[$type][$ID]['hostname'] = 'dedi-' . $ID;
             $this->ID[$type][$ID]['usePXE'] = $row['usePXE'];
             $this->ID[$type][$ID]['pxeID'] = $row['pxeID'];
             $this->ID[$type][$ID]['pxeIP'] = '';
             $this->ID[$type][$ID]['mac'] = $row['mac'];
             $this->ID[$type][$ID]['ip'] = $row['ip'];
             $this->ID[$type][$ID]['restart'] = $row['restart'];
             $this->ID[$type][$ID]['apiRequestType'] = $row['apiRequestType'];
             $this->ID[$type][$ID]['apiRequestRestart'] = $row['apiRequestRestart'];
             $this->ID[$type][$ID]['apiRequestStop'] = $row['apiRequestStop'];
             $this->ID[$type][$ID]['https'] = $row['https'];
             $this->ID[$type][$ID]['apiURL'] = $row['apiURL'];
             $userID = $row['userID'];
             $resellerID = $row['resellerID'];
         }
         // Get VMware data
     } else {
         if ($this->type == 'vmware') {
             $query = $this->sql->prepare("SELECT c.*,u.`id` AS `userID`,u.`cname`,h.`cores` AS `hcore`,h.`esxi`,h.`id` AS `hostID`,h.`ip` AS `hip`,AES_DECRYPT(h.`port`,:aeskey) AS `dport`,AES_DECRYPT(h.`user`,:aeskey) AS `duser`,AES_DECRYPT(h.`pass`,:aeskey) AS `dpass`,h.`publickey`,h.`keyname` FROM `virtualcontainer` c INNER JOIN `userdata` u ON c.`userid`=u.`id` INNER JOIN `virtualhosts` h ON c.`hostid`=h.`id` WHERE c.`id`=:vmID LIMIT 1");
             $query->execute(array(':aeskey' => $this->aeskey, ':vmID' => $this->tempID));
             while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                 if (!isset($this->vmwareHosts[$row['hostID']])) {
                     $this->vmwareHosts[$row['hostID']]['vmIDs']['ip'] = $row['hip'];
                     $this->vmwareHosts[$row['hostID']]['vmIDs']['dport'] = $row['dport'];
                     $this->vmwareHosts[$row['hostID']]['vmIDs']['duser'] = $row['duser'];
                     $this->vmwareHosts[$row['hostID']]['vmIDs']['dpass'] = $row['dpass'];
                     $this->vmwareHosts[$row['hostID']]['vmIDs']['publickey'] = $row['publickey'];
                     $this->vmwareHosts[$row['hostID']]['vmIDs']['keyname'] = $row['keyname'];
                 }
                 $this->ID[$type][$ID]['cores'] = $row['cores'];
                 $this->ID[$type][$ID]['mountpoint'] = $row['mountpoint'];
                 $this->ID[$type][$ID]['hostname'] = $row['cname'] . '-' . $this->tempID;
                 $this->ID[$type][$ID]['ram'] = 1024 * $row['ram'];
                 $this->ID[$type][$ID]['minram'] = 1024 * $row['minram'];
                 $this->ID[$type][$ID]['maxram'] = 1024 * $row['maxram'];
                 $this->ID[$type][$ID]['minmhz'] = $row['cores'] * $row['minmhz'];
                 $this->ID[$type][$ID]['maxmhz'] = $row['cores'] * $row['maxmhz'];
                 $this->ID[$type][$ID]['hddsize'] = $row['hddsize'] . 'GB';
                 $this->ID[$type][$ID]['mac'] = $row['mac'];
                 $this->ID[$type][$ID]['pxeID'] = $row['pxeID'];
                 $this->ID[$type][$ID]['hostname'] = 'vmware-' . $ID;
                 $this->ID[$type][$ID]['mac'] = $row['mac'];
                 $this->ID[$type][$ID]['ip'] = $row['ip'];
                 $this->ID[$type][$ID]['usePXE'] = 'Y';
                 $this->ID[$type][$ID]['restart'] = 'Y';
                 $this->ID[$type][$ID]['distro'] = isset($distro) ? $distro : '';
                 $this->ID[$type][$ID]['guestos'] = isset($guestos) ? $guestos : '';
                 $hostID = $row['hostid'];
                 $userID = $row['userid'];
                 $resellerID = $row['resellerid'];
                 $this->vmwareHosts[$row['hostID']]['actions'][] = array('action' => $action, 'id' => $ID);
             }
         }
     }
     if (!isset($row['ip'])) {
         return 'Database Error: Could not find VM or ESX(i) host for ID: ' . $this->tempID;
     }
     if (!in_array($action, array('md', 'ad', 'dl', 'rp')) and ($this->type == 'vmware' or $this->type == 'dedicated' and $this->ID[$type][$ID]['usePXE'] == 'Y') and !isid($imageID, 10)) {
         unset($this->ID[$type][$ID]);
         return 'Image Error: No imageID defined for Server with ID: ' . $this->tempID;
     } else {
         if (!in_array($action, array('md', 'ad', 'dl', 'rp')) and ($this->type == 'vmware' or $this->type == 'dedicated' and $this->ID[$type][$ID]['usePXE'] == 'Y') and !isset($guestos)) {
             unset($this->ID[$type][$ID]);
             return 'Image Error: Cannot find image with imageID ' . $imageID . ' defined for Server with ID: ' . $this->tempID;
         } else {
             if (!in_array($action, array('re', 'st'))) {
                 // get DHCP Data from DB
                 if ($action != 'rp' and ($this->type == 'vmware' or $this->type == 'dedicated' and $this->ID[$type][$ID]['useDHCP'] == 'Y')) {
                     $query = $this->sql->prepare("SELECT s.*,d.*,AES_DECRYPT(d.`port`,:aeskey) AS `dport`,AES_DECRYPT(d.`user`,:aeskey) AS `duser`,AES_DECRYPT(d.`pass`,:aeskey) AS `dpass` FROM `rootsIP4` i INNER JOIN `rootsSubnets` s ON i.`subnetID`=s.`subnetID` INNER JOIN `rootsDHCP` d ON s.`dhcpServer`=d.`id` WHERE i.`ip`=:ip AND d.`active`='Y' LIMIT 1");
                     $query->execute(array(':aeskey' => $this->aeskey, ':ip' => $this->ID[$type][$ID]['ip']));
                     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                         $foundDHCP = true;
                         $modID = $row['id'];
                         if (!isset($this->dhcpData[$row['id']])) {
                             $this->dhcpData[$row['id']]['ip'] = $row['ip'];
                             $this->dhcpData[$row['id']]['port'] = $row['dport'];
                             $this->dhcpData[$row['id']]['user'] = $row['duser'];
                             $this->dhcpData[$row['id']]['pass'] = $row['dpass'];
                             $this->dhcpData[$row['id']]['publickey'] = $row['publickey'];
                             $this->dhcpData[$row['id']]['keyname'] = $row['keyname'];
                             $this->dhcpData[$row['id']]['startCmd'] = $row['startCmd'];
                             $this->dhcpData[$row['id']]['dhcpFile'] = $row['dhcpFile'];
                             $this->dhcpData[$row['id']]['subnets'][$row['subnet']] = array('netmask' => $row['netmask'], 'subnetOptions' => $row['subnetOptions']);
                         }
                         if ($row['vlan'] == 'Y') {
                             $this->ID[$type][$ID]['vlan'] = $row['vlanName'];
                         }
                         $this->ID[$type][$ID]['subnet'] = $row['subnet'];
                         $this->dhcpData[$row['id']]['actions'][] = array('action' => $action, 'id' => $ID, 'type' => $type, 'imageID' => $imageID, 'hostID' => $hostID, 'userID' => $userID, 'resellerID' => $resellerID);
                     }
                     if ($action == 'md' and isset($this->extraData['oldip']) and $this->extraData['oldip'] != $this->ID[$type][$ID]['ip']) {
                         $query = $this->sql->prepare("SELECT s.*,d.*,AES_DECRYPT(d.`port`,:aeskey) AS `dport`,AES_DECRYPT(d.`user`,:aeskey) AS `duser`,AES_DECRYPT(d.`pass`,:aeskey) AS `dpass` FROM `rootsIP4` i INNER JOIN `rootsSubnets` s ON i.`subnetID`=s.`subnetID` INNER JOIN `rootsDHCP` d ON s.`dhcpServer`=d.`id` WHERE i.`ip`=:ip AND d.`active`='Y' LIMIT 1");
                         $query->execute(array(':aeskey' => $this->aeskey, ':ip' => $this->extraData['oldip']));
                         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                             $foundDHCP = true;
                             if (!isset($this->dhcpData[$row['id']])) {
                                 $this->dhcpData[$row['id']]['ip'] = $row['ip'];
                                 $this->dhcpData[$row['id']]['port'] = $row['dport'];
                                 $this->dhcpData[$row['id']]['user'] = $row['duser'];
                                 $this->dhcpData[$row['id']]['pass'] = $row['dpass'];
                                 $this->dhcpData[$row['id']]['publickey'] = $row['publickey'];
                                 $this->dhcpData[$row['id']]['keyname'] = $row['keyname'];
                                 $this->dhcpData[$row['id']]['netmask'] = $row['netmask'];
                                 $this->dhcpData[$row['id']]['startCmd'] = $row['startCmd'];
                                 $this->dhcpData[$row['id']]['dhcpFile'] = $row['dhcpFile'];
                             }
                             if ($row['vlan'] == 'Y') {
                                 $this->ID[$type][$ID]['oldVlan'] = $row['vlanName'];
                             }
                             $this->ID[$type][$ID]['oldSubnet'] = $row['subnet'];
                             if (isset($modID) and $modID != $row['id']) {
                                 $this->dhcpData[$row['id']]['actions'][] = array('action' => 'del', 'id' => $ID, 'type' => $type, 'imageID' => $imageID, 'hostID' => $hostID, 'userID' => $userID, 'resellerID' => $resellerID);
                             }
                         }
                     }
                     if (!isset($foundDHCP)) {
                         unset($this->ID[$type][$ID]);
                         return 'Database Error: Could not find DHCP Server for IP: ' . $this->extraData['oldip'];
                     }
                 }
                 // Get PXE Data
                 if ($this->ID[$type][$ID]['usePXE'] == 'Y') {
                     if (isid($this->ID[$type][$ID]['pxeID'], 10)) {
                         $query = $this->sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass` FROM `rootsPXE` WHERE `active`='Y' AND `id`=:pxeID LIMIT 1");
                         $query->execute(array(':aeskey' => $this->aeskey, ':pxeID' => $this->ID[$type][$ID]['pxeID']));
                         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                             $foundPXE = true;
                             $this->ID[$type][$ID]['pxeIP'] = $row['ip'];
                             $this->ID[$type][$ID]['pxeID'] = $row['id'];
                             if (!isset($this->PXEData[$row['id']])) {
                                 $this->PXEData[$row['id']]['ip'] = $row['ip'];
                                 $this->PXEData[$row['id']]['port'] = $row['dport'];
                                 $this->PXEData[$row['id']]['user'] = $row['duser'];
                                 $this->PXEData[$row['id']]['pass'] = $row['dpass'];
                                 $this->PXEData[$row['id']]['publickey'] = $row['publickey'];
                                 $this->PXEData[$row['id']]['keyname'] = $row['keyname'];
                                 $this->PXEData[$row['id']]['PXEFolder'] = $row['PXEFolder'];
                             }
                             $this->PXEData[$row['id']]['actions'][] = array('action' => $action, 'id' => $ID, 'type' => $type, 'imageID' => $imageID, 'hostID' => $hostID, 'userID' => $userID, 'resellerID' => $resellerID);
                         }
                     }
                     if ((!isset($foundPXE) or !isip($this->ID[$type][$ID]['pxeIP'], 'ip4')) and $action != 'dl') {
                         $query = $this->sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass` FROM `rootsPXE` WHERE `active`='Y' ORDER BY RAND() LIMIT 1");
                         $query->execute(array(':aeskey' => $this->aeskey));
                         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                             $foundPXE = true;
                             $this->ID[$type][$ID]['pxeIP'] = $row['ip'];
                             $this->ID[$type][$ID]['pxeID'] = $row['id'];
                             if (!isset($this->PXEData[$row['id']])) {
                                 $this->PXEData[$row['id']]['ip'] = $row['ip'];
                                 $this->PXEData[$row['id']]['port'] = $row['dport'];
                                 $this->PXEData[$row['id']]['user'] = $row['duser'];
                                 $this->PXEData[$row['id']]['pass'] = $row['dpass'];
                                 $this->PXEData[$row['id']]['publickey'] = $row['publickey'];
                                 $this->PXEData[$row['id']]['keyname'] = $row['keyname'];
                                 $this->PXEData[$row['id']]['PXEFolder'] = $row['PXEFolder'];
                             }
                             $this->PXEData[$row['id']]['actions'][] = array('action' => $action, 'id' => $ID, 'type' => $type, 'imageID' => $imageID, 'hostID' => $hostID, 'userID' => $userID, 'resellerID' => $resellerID);
                         }
                     }
                     if (!isset($foundPXE) and $action != 'dl') {
                         unset($this->ID[$type][$ID]);
                         return 'Database Error: Could not find PXE Server';
                     }
                 }
             }
         }
     }
     if ($this->ID[$type][$ID]['restart'] == 'A' and $this->type == 'dedicated' and $action != 'rp') {
         $this->startStop[] = array('action' => (isset($this->extraData['oldactive']) and $this->extraData['oldactive'] == 'Y' or in_array($action, array('ad', 'st', 'dl'))) ? 'st' : 're', 'id' => $ID);
     } else {
         if ($this->type == 'dedicated' and $action != 'rp') {
             return 'Restart not allowed for Server with ID: ' . $this->tempID;
         }
     }
     return true;
 }