Exemplo n.º 1
0
function getip()
{
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]) && isip($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        return $_SERVER["HTTP_X_FORWARDED_FOR"];
    } elseif (isip($_SERVER["REMOTE_ADDR"])) {
        return $_SERVER["REMOTE_ADDR"];
    } else {
        return '128.0.0.1';
    }
}
Exemplo n.º 2
0
         } else {
             $pselect = $sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`userid`=:admin_id AND c.`resellerid`=:reseller_id ORDER BY u.`id`,c.`id`");
             $pselect->execute(array(':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
         }
     }
     foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
         if ($ui->post['what'] == $row['id']) {
             $data[] = '<option value=' . $row['id'] . ' selected="selected">' . $row['cname'] . '-' . $row['id'] . '</option>';
         } else {
             $data[] = '<option value=' . $row['id'] . '>' . $row['cname'] . '-' . $row['id'] . '</option>';
         }
     }
 } else {
     if ($ui->post['kind'] == "ip") {
         $kind = "ip";
         if (isip($ui->post['what'], 'all')) {
             $whichdata = "&amp;ip=" . $ui->post['what'];
             $display = $sprache->ip . '  ' . $ui->post['what'];
         }
         if ($reseller_id == 0) {
             $pselect = $sql->prepare("SELECT `ips` FROM `resellerdata`");
             $pselect->execute();
         } else {
             if ($reseller_id == $admin_id) {
                 $pselect = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellersid`=:reseller_id");
                 $pselect->execute(array(':reseller_id' => $reseller_id));
             } else {
                 $pselect = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellerid`=:admin_id AND c.`resellersid`=:reseller_id");
                 $pselect->execute(array(':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
             }
         }
Exemplo n.º 3
0
 if ($query->fetchColumn() > 0) {
     $success['false'][] = 'Server is marked for deletion';
 }
 $updateArray = array();
 $eventualUpdate = '';
 if (isset($data['active']) and active_check($data['active'])) {
     $updateArray[] = $data['active'];
     $eventualUpdate .= ',`active`=?';
     $active = $data['active'];
 }
 if (isset($data['dns']) and isdomain($data['dns'])) {
     $updateArray[] = $data['dns'];
     $eventualUpdate .= ',`dns`=?';
     $dns = $data['dns'];
 }
 if (isset($data['ip']) and isip($data['ip'], 'ip4')) {
     $updateArray[] = $data['ip'];
     $eventualUpdate .= ',`ip`=?';
     $ip = $data['ip'];
 }
 if (isset($data['port']) and port($data['port'])) {
     $updateArray[] = $data['port'];
     $eventualUpdate .= ',`port`=?';
     $port = $data['port'];
 }
 if (isExternalID($data['server_external_id']) and $data['identify_server_by'] == 'server_local_id') {
     $updateArray[] = $data['server_external_id'];
     $eventualUpdate .= ',`externalID`=?';
 }
 if (count($updateArray) > 0 and !isset($success['false'])) {
     $eventualUpdate = trim($eventualUpdate, ',');
Exemplo n.º 4
0
        }
    }
    if (isset($xml) and !$xml) {
        header('HTTP/1.1 403 Forbidden');
        echo '403 Forbidden: XML not valid. Decoded XML is:';
        if ($ui->escaped('game', 'post')) {
            echo base64_decode($ui->escaped('game', 'post'));
        } else {
            if ($ui->escaped('ipblocked', 'post')) {
                echo base64_decode($ui->escaped('ipblocked', 'post'));
            }
        }
        die;
    } else {
        if (isset($xml)) {
            if (isip($xml->userip, 'all')) {
                $loguserip = $xml->userip;
            } else {
                $error = 'no userip</br>';
                $fail = 1;
            }
        }
    }
}
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `voice_server` WHERE `lendserver`='Y' AND `active`='Y' AND `resellerid`=?");
$query->execute(array($reseller_id));
$vocount = $query->fetchColumn();
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `gsswitch` WHERE `lendserver`='Y' AND `resellerid`=?");
$query->execute(array($reseller_id));
$gscount = $query->fetchColumn();
if ($activeGS == 'Y' and ($w == 'gs' or $d == 'gs' or $ui->st('w', 'post') == 'gs' or isset($page_name) and $page_name == strtolower(str_replace(' ', '-', $gsprache->gameserver)))) {
Exemplo n.º 5
0
 private function checkIfImageServerIsInSameSubnet($type, $imageString)
 {
     // Get the imageserver if possible and use Easy-WI server as fallback
     $mainIp = explode('.', $this->sship);
     $mainSubnet = $mainIp[0] . '.' . $mainIp[1] . '.' . $mainIp[2];
     if ($type == 'rsync') {
         $splitPaths = @preg_split('/\\//', $imageString, -1, PREG_SPLIT_NO_EMPTY);
         $splitCredentialsAndServer = isset($split1[1]) ? preg_split('/\\:/', $splitPaths[1], -1, PREG_SPLIT_NO_EMPTY) : preg_split('/\\:/', $splitPaths[0], -1, PREG_SPLIT_NO_EMPTY);
     } else {
         $splitPaths = @preg_split('/\\//', $imageString, -1, PREG_SPLIT_NO_EMPTY);
         $splitCredentialsAndServer = isset($split1[1]) ? preg_split('/\\@/', $splitPaths[1], -1, PREG_SPLIT_NO_EMPTY) : preg_split('/\\@/', $splitPaths[0], -1, PREG_SPLIT_NO_EMPTY);
     }
     foreach ($splitCredentialsAndServer as $splitIp) {
         if ($splitIp != $this->sship && isip($splitIp, 'all')) {
             $ipParts = explode('.', $splitIp);
             $subnet = $ipParts[0] . '.' . $ipParts[1] . '.' . $ipParts[2];
             if ($mainSubnet == $subnet) {
                 return $imageString;
             }
         }
     }
     return false;
 }
Exemplo n.º 6
0
                 $i++;
                 if ($i == $coreCount or $i == $data['coreCount']) {
                     break;
                 }
             }
             $calculatedCores = implode(',', $calculatedCores);
         }
         foreach (preg_split('/\\r\\n/', $row['altips'], -1, PREG_SPLIT_NO_EMPTY) as $ip) {
             $ips[] = $ip;
         }
         $used = usedPorts($ips);
         $ip = $used['ip'];
         $ports = $used['ports'];
     }
 }
 if (!isset($success['false']) and isip($ip, 'ip4')) {
     if ($portMax > 0) {
         if (isset($data['port']) and checkPorts(array($data['port']), $ports) === true) {
             $port = $data['port'];
         }
         while (in_array($port, $ports)) {
             $port += $portStep;
         }
     }
     if ($portMax > 1) {
         if (isset($data['port2']) and checkPorts(array($data['port2']), $ports) === true) {
             $port = $data['port'];
         }
         while (in_array($port2, $ports)) {
             $port2 += $portStep;
         }
                     $checked_ips[] = $postedip;
                 }
             }
         }
         foreach ($checked_ips as $checked_ip) {
             if (isset($ips)) {
                 $ips .= "\r\n" . $checked_ip;
             } else {
                 $ips = $checked_ip;
             }
         }
     }
     if ($ui->post['ip'] == $oldip or in_array($ui->post['ip'], $freeips)) {
         $ip = $ui->post['ip'];
     } else {
         if (isset($checked_ips[0]) and isip($checked_ips[0], 'all')) {
             $ip = $checked_ips[0];
         }
     }
     if (!isset($ips)) {
         $ips = '';
     }
     if (!isset($ip)) {
         $fail = 1;
         $template_file .= "IP";
     }
 } else {
     $fail = 1;
     $template_file .= "No/Bad IP";
 }
 if ($fail != 1 and isset($oldmac)) {
Exemplo n.º 8
0
 $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;
         default:
             $words[] = strtolower($s);
             $q[] = $s;
     }
 }
 $ips = array_unique($ips);
 $addresses = array_unique($addresses);
Exemplo n.º 9
0
$query = $sql->prepare("SELECT r.`connect_ip_only`,r.`ip`,r.`altips`,r.`maxslots`,r.`maxserver`,r.`ram`,r.`cores`,r.`hyperthreading`,r.`install_paths`,r.`quota_active`,COUNT(g.`id`) AS `installedServer`,SUM(g.`slots`) AS `installedSlots`,SUM(g.`maxram`) AS `installedRam` FROM `rserverdata` AS r LEFT JOIN `gsswitch` AS g ON g.`rootID`=r.`id` WHERE r.`id`=? AND r.`resellerid`=? LIMIT 1");
$query2 = $sql->prepare("SELECT SUM(`hdd`) AS `hdd_used` FROM `gsswitch` WHERE `rootID`=? AND `homeLabel`=?");
$query->execute(array($ui->id('id', 10, 'get'), $resellerLockupID));
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
    $maxSlots = (int) $row['maxslots'];
    $maxServer = (int) $row['maxserver'];
    $maxRam = (int) $row['ram'];
    $installedServer = (int) $row['installedServer'];
    $installedSlots = (int) $row['installedSlots'];
    $installedRam = (int) $row['installedRam'];
    $quotaActive = $row['quota_active'];
    if ($row['connect_ip_only'] != 'Y' and isip($row['ip'], 'ip4')) {
        $ips[] = $row['ip'];
    }
    foreach (preg_split('/\\r\\n/', $row['altips'], -1, PREG_SPLIT_NO_EMPTY) as $ip) {
        if (isip($ip, 'ip4')) {
            $ips[] = $ip;
        }
    }
    $coreCount = $row['hyperthreading'] == 'Y' ? $row['cores'] * 2 : $row['cores'];
    for ($c = 0; $c < $coreCount; $c++) {
        $cores[$c] = 0;
    }
    $iniVars = parse_ini_string($row['install_paths'], true);
    if ($iniVars) {
        foreach ($iniVars as $key => $values) {
            $table2[] = $key;
            if (isset($values['default']) and $values['default'] == 1) {
                $homeDir = $key;
            }
            if (isset($values['size'])) {
Exemplo n.º 10
0
 public function ImportData($dnsarray)
 {
     if (!is_array($dnsarray)) {
         $dnsarray = (array) $dnsarray;
     }
     $serverdetails = array();
     $serverlist = $this->SendCommand('serverlist');
     foreach ($serverlist as $server) {
         if (isset($server['virtualserver_id'])) {
             $virtualserver_id = $server['virtualserver_id'];
             if ($server['virtualserver_status'] == 'offline') {
                 $this->StartServer($virtualserver_id);
             }
             $useserver = $this->UseServer($virtualserver_id);
             if (isset($useserver[0]['msg']) and strtolower($useserver[0]['msg']) == 'ok') {
                 $virtualserver_ip = (isset($serverdetails_query[0]['virtualserver_ip']) and isip($serverdetails_query[0]['virtualserver_ip'], 'all')) ? $serverdetails_query[0]['virtualserver_ip'] : $this->ip;
                 $serverdetails_query = $this->SendCommand('serverinfo');
                 $virtualserver_server = $virtualserver_ip . ':' . $server['virtualserver_port'];
                 $virtualserver_dns = array_key_exists($virtualserver_server, $dnsarray) ? $dnsarray[$virtualserver_server] : '';
                 $serverdetails[$virtualserver_id] = array('virtualserver_ip' => $virtualserver_ip, 'virtualserver_maxclients' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_maxclients'), 'virtualserver_port' => $server['virtualserver_port'], 'virtualserver_dns' => $virtualserver_dns, 'virtualserver_name' => $this->ReplaceFromTS3($this->tenaryReturn($serverdetails_query[0], 'virtualserver_name')), 'virtualserver_welcomemessage' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_welcomemessage'), 'virtualserver_flag_password' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_flag_password'), 'virtualserver_max_download_total_bandwidth' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_max_download_total_bandwidth'), 'virtualserver_max_upload_total_bandwidth' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_max_upload_total_bandwidth'), 'virtualserver_hostbanner_url' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_hostbanner_url'), 'virtualserver_hostbanner_gfx_url' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_hostbanner_gfx_url'), 'virtualserver_hostbutton_tooltip' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_hostbutton_tooltip'), 'virtualserver_hostbutton_url' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_hostbutton_url'), 'virtualserver_hostbutton_gfx_url' => $this->tenaryReturn($serverdetails_query[0], 'virtualserver_hostbutton_gfx_url'));
             }
             if ($server['virtualserver_status'] == 'offline') {
                 $this->StopServer($virtualserver_id);
             }
             if (!isset($serverdetails[$virtualserver_id])) {
                 $virtualserver_ip = isset($virtualserver_ip) ? $virtualserver_ip : '';
                 $virtualserver_dns = isset($virtualserver_dns) ? $virtualserver_dns : '';
                 $serverdetails[$virtualserver_id] = array('virtualserver_ip' => $virtualserver_ip, 'virtualserver_maxclients' => $server['virtualserver_maxclients'], 'virtualserver_port' => $server['virtualserver_port'], 'virtualserver_dns' => $virtualserver_dns, 'virtualserver_name' => '', 'virtualserver_welcomemessage' => '', 'virtualserver_flag_password' => '', 'virtualserver_max_download_total_bandwidth' => '', 'virtualserver_max_upload_total_bandwidth' => '', 'virtualserver_hostbanner_url' => '', 'virtualserver_hostbanner_gfx_url' => '', 'virtualserver_hostbutton_tooltip' => '', 'virtualserver_hostbutton_url' => '', 'virtualserver_hostbutton_gfx_url' => '');
             }
         }
     }
     return $serverdetails;
 }
Exemplo n.º 11
0
     }
     $query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r' ORDER BY `id` DESC");
     $query->execute(array(':reseller_id' => $reseller_id));
     foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
         $table[] = $resellerid == $row['id'] ? '<option value="' . $row['id'] . '" selected="selected">' . $row['cname'] . '</option>' : '<option value="' . $row['id'] . '">' . $row['cname'] . '</option>';
     }
     $template_file = "admin_root_virtualhosts_md.tpl";
 } else {
     if ($ui->smallletters('action', 2, 'post') == 'md') {
         $fail = 0;
         $template_file = 'admin_404.tpl';
         if (!isid($ui->post['reseller'], 10) and $ui->post['reseller'] != 0) {
             $fail = 1;
             echo "test" . $ui->post['reseller'];
         }
         if (!isip($ui->post['ip'], "all")) {
             $fail = 1;
             $template_file .= "IP <br />";
         }
         if (!isid($ui->post['port'], "5")) {
             $fail = 1;
             $template_file .= "Port <br />";
         }
         if (!uname_check($ui->post['user'], "20")) {
             $fail = 1;
             $template_file .= "User <br />";
         }
         if (!wpreg_check($ui->post['publickey'], 1)) {
             $fail = 1;
             $template_file .= "Key <br />";
         }
Exemplo n.º 12
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;
 }