');
$this->outputString('
');
$this->tagClose('div', 3);
}
protected function getProvider(int $provider)
{
$select = $this->dbConnect()->prepare("SELECT `name` FROM `providers` WHERE `id` = ? LIMIT 1;");
$select->execute([$provider]);
$row = $select->fetch(PDO::FETCH_ASSOC);
if (!empty($row)) {//Yes
return $row['name'];
} else {//NO
return null;
}
}
protected function getLocation(int $location)
{
$select = $this->dbConnect()->prepare("SELECT `name` FROM `locations` WHERE `id` = ? LIMIT 1;");
$select->execute([$location]);
$row = $select->fetch(PDO::FETCH_ASSOC);
if (!empty($row)) {//Yes
return $row['name'];
} else {//NO
return null;
}
}
public function serverDetails(string $id)
{
$select = $this->dbConnect()->prepare("SELECT id, hostname, location, provider, ipv4, ipv6, `cpu`, cpu_type, cpu_freq, ram, ram_type, swap, swap_type, `disk`, disk_type, bandwidth, bandwidth_type, gb5_single, gb5_multi, gb5_id, aes_ni, amd_v, is_dedicated, is_cpu_dedicated, was_special, os, still_have, DATE_FORMAT(`owned_since`, '%M %Y') as owned_since FROM `servers` WHERE `id` = ? LIMIT 1;");
$select->execute([$id]);
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
return json_encode($data);
}
public function serverData(string $id)
{
$select = $this->dbConnect()->prepare("SELECT `has_yabs`, `has_st` FROM `servers` WHERE `id` = ? LIMIT 1;");
$select->execute([$id]);
$row = $select->fetch();
if ($row['has_yabs'] == 1 && $row['has_st'] == 1) {
$select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
$select->execute([$id]);
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
$sel_st = $this->dbConnect()->prepare("SELECT `location`, `send`, `send_type`, `recieve`, `recieve_type` FROM `speed_tests` WHERE `server_id` = ? ORDER BY `datetime` DESC LIMIT 8;");
$sel_st->execute([$id]);
$speed_tests = $sel_st->fetchAll(PDO::FETCH_ASSOC);
$final = array_merge($speed_tests, $data);
return json_encode($final);
} elseif ($row['has_yabs'] == 1 && $row['has_st'] == 0) {
$select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
$select->execute([$id]);
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
return json_encode($data);
} else {
$select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,
bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2,label,has_st,
DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
FROM servers INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
$select->execute([$id]);
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
return json_encode($data);
}
}
public function sharedHostingData(string $id)
{
$select = $this->dbConnect()->prepare("
SELECT shared_hosting.id as server_id, domain, domains_limit, emails, disk, disk_type, disk_as_gb, ftp, db, bandwidth, provider, location, was_special,
still_have, type, `owned_since` as owned_since_raw, DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,next_dd,pr.name as provider
FROM shared_hosting INNER JOIN locations loc on shared_hosting.location = loc.id
INNER JOIN providers pr on shared_hosting.provider = pr.id INNER JOIN pricing on shared_hosting.id = pricing.server_id WHERE shared_hosting.id = ? LIMIT 1;");
$select->execute([$id]);
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
return json_encode($data);
}
public function domainData(string $id)
{
$select = $this->dbConnect()->prepare("
SELECT domains.id as server_id, domain, attached_to, ns1, ns2, still_have, `owned_since` as owned_since_raw, DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,price,currency,term,as_usd,per_month,next_dd,pr.name as provider
FROM domains INNER JOIN providers pr on domains.provider = pr.id INNER JOIN pricing on domains.id = pricing.server_id WHERE domains.id = ? LIMIT 1;");
$select->execute([$id]);
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
return json_encode($data);
}
protected function serverCards()
{
if (self::SRV_SORT_TYPE == 'HOSTNAME_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname` DESC;");
} elseif (self::SRV_SORT_TYPE == 'HOSTNAME_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname`;");
} elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since` DESC;");
} elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since`;");
} elseif (self::SRV_SORT_TYPE == 'PRICE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd` DESC;");
} elseif (self::SRV_SORT_TYPE == 'PRICE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd`;");
} elseif (self::SRV_SORT_TYPE == 'DUE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd` DESC;");
} elseif (self::SRV_SORT_TYPE == 'DUE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd`;");
} else {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers`;");
}
$select->execute();
$count = $select->rowCount();
if ($count > 0) {
$this->HTMLPhrase('h4', 'card-section-header', 'Servers ' . $count . '');
}
$this->tagOpen('div', 'row');
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
$this->vpsCard($row['id']);
}
$this->tagClose('div');
}
protected function sharedHostingCards()
{
if (self::SH_SORT_TYPE == 'DOMAIN_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `domain` DESC;");
} elseif (self::SH_SORT_TYPE == 'DOMAIN_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `domain`;");
} elseif (self::SH_SORT_TYPE == 'OWNED_SINCE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `owned_since` DESC;");
} elseif (self::SH_SORT_TYPE == 'OWNED_SINCE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `owned_since`;");
} elseif (self::SH_SORT_TYPE == 'PRICE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `as_usd` DESC;");
} elseif (self::SH_SORT_TYPE == 'PRICE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `as_usd`;");
} elseif (self::SH_SORT_TYPE == 'DUE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `next_dd` DESC;");
} elseif (self::SH_SORT_TYPE == 'DUE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `next_dd`;");
} else {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting`;");
}
$select->execute();
$count = $select->rowCount();
if ($count > 0) {
$this->HTMLPhrase('h4', 'card-section-header', 'Shared hosting ' . $count . '');
}
$this->tagOpen('div', 'row');
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
$this->SharedHostingCard($row['id']);
}
$this->tagClose('div');
}
protected function domainCards()
{
if (self::DC_SORT_TYPE == 'DOMAIN_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `domain` DESC;");
} elseif (self::DC_SORT_TYPE == 'DOMAIN_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `domain`;");
} elseif (self::DC_SORT_TYPE == 'OWNED_SINCE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `owned_since` DESC;");
} elseif (self::DC_SORT_TYPE == 'OWNED_SINCE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `owned_since`;");
} elseif (self::DC_SORT_TYPE == 'PRICE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `as_usd` DESC;");
} elseif (self::DC_SORT_TYPE == 'PRICE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `as_usd`;");
} elseif (self::DC_SORT_TYPE == 'DUE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `next_dd` DESC;");
} elseif (self::DC_SORT_TYPE == 'DUE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `next_dd`;");
} else {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains`;");
}
$select->execute();
$count = $select->rowCount();
if ($count > 0) {
$this->HTMLPhrase('h4', 'card-section-header', 'Domains ' . $count . '');
}
$this->tagOpen('div', 'row');
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
$this->domainCard($row['id']);
}
$this->tagClose('div');
}
protected function serverTable()
{
if (self::SRV_SORT_TYPE == 'HOSTNAME_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname` DESC;");
} elseif (self::SRV_SORT_TYPE == 'HOSTNAME_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname`;");
} elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since` DESC;");
} elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since`;");
} elseif (self::SRV_SORT_TYPE == 'PRICE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd` DESC;");
} elseif (self::SRV_SORT_TYPE == 'PRICE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd`;");
} elseif (self::SRV_SORT_TYPE == 'DUE_DESC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd` DESC;");
} elseif (self::SRV_SORT_TYPE == 'DUE_ASC') {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd`;");
} else {
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers`;");
}
$select->execute();
$count = $select->rowCount();
if ($count > 0) {
$this->HTMLPhrase('h4', 'card-section-header', 'Servers ' . $count . '');
$this->tagOpen('div', 'row');
$this->tableHeader(array('Hostname', '', '', 'Type', 'CPU', 'RAM', 'Disk', 'Price', 'OS', 'Location', 'Provider', 'Due', 'Owned', 'IPv4', 'IPv6', 'Tags'), 'table objects-table', 'serversTable');
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
$this->vpsTableRow($row['id']);
}
$this->outputString('