');
@@ -1607,6 +1641,8 @@ class idlers extends helperFunctions
$this->tagClose('select');
$this->tagClose('div', 3);
+ $this->attachDomainInput();
+
$this->rowColOpen('form-row', 'col-12');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('Owned since');
@@ -1955,12 +1991,17 @@ class idlers extends helperFunctions
$this->tagClose('select');
$this->tagClose('div', 3);
- $this->rowColOpen('form-row', 'col-12 col-md-6');
+ $this->rowColOpen('form-row', 'col-12 col-md-4');
+ $this->tagOpen('div', 'input-group');
+ $this->inputPrepend('Label');
+ $this->textInput('label', '', 'form-control', false, 1, 24);
+ $this->tagClose('div', 2);
+ $this->colOpen('col-12 col-md-4');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('IPv4');
$this->textInput('ipv4', '', 'form-control', false, 4, 124);
$this->tagClose('div', 2);
- $this->colOpen('col-12 col-md-6');
+ $this->colOpen('col-12 col-md-4');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('IPv6');
$this->textInput('ipv6', '', 'form-control', false, 4, 124);
@@ -2058,11 +2099,11 @@ class idlers extends helperFunctions
public function searchResults(string $search_term)
{
if (!empty($search_term)) {
- $select = $this->dbConnect()->prepare("SELECT `id`, `hostname`,`ipv4`, `virt`, p.price, p.currency, p.term FROM `servers` INNER JOIN pricing p on servers.id = p.server_id WHERE `hostname` LIKE ? OR `ipv4` LIKE ? LIMIT 30;");
- $select->execute(["%$search_term%", "%$search_term%"]);
+ $select = $this->dbConnect()->prepare("SELECT `id`, `hostname`,`ipv4`, `virt`, `tags`, `label`, p.price, p.currency, p.term FROM `servers` INNER JOIN pricing p on servers.id = p.server_id WHERE `hostname` LIKE ? OR `ipv4` LIKE ? OR `tags` LIKE ? OR `label` LIKE ? LIMIT 30;");
+ $select->execute(["%$search_term%", "%$search_term%", "%$search_term%", "%$search_term%"]);
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
$this->rowColOpen('row search-result', 'col-6');
- $this->outputString("
{$row['hostname']} {$row['ipv4']}
{$row['virt']} {$row['price']} {$row['currency']} " . $this->paymentTerm($row['term']) . "
");
+ $this->outputString("
{$row['hostname']} {$row['ipv4']}
{$row['virt']} {$row['price']} {$row['currency']} " . $this->paymentTerm($row['term']) . " {$row['label']}
");
$this->tagClose('div');
$this->colOpen('col-3');
$this->outputString('
View');
@@ -2157,11 +2198,8 @@ class idlers extends helperFunctions
if (!isset($data)) {//returned no data
exit;
}
- if (is_null($data['ipv6']) || empty($data['ipv6'])) {
- $ipv6 = '-';
- } else {
- $ipv6 = $data['ipv6'];
- }
+ (is_null($data['ipv6']) || empty($data['ipv6'])) ? $ipv6 = '-' : $ipv6 = $data['ipv6'];
+
($data['has_yabs'] == 1) ? $has_yabs = true : $has_yabs = false;
($data['has_st'] == 1) ? $has_st = true : $has_st = false;
$this->tagOpen('div', 'modal-header');
@@ -2169,157 +2207,125 @@ class idlers extends helperFunctions
$this->outputString('
');
$this->tagClose('div');
$this->tagOpen('div', 'modal-body');
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'IPv4');
- $this->tagClose('div');
- $this->colOpen('col-8');
- $this->outputString('
' . $data['ipv4'] . '
');
- $this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'IPv6');
+ if (!is_null($data['label']) || !empty($data['label'])) {
+ $this->rowColOpen('row m-row', 'col-4 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'Label');
+ $this->tagClose('div');
+ $this->colOpen('col-8');
+ $this->outputString('
' . $data['label'] . '
');
+ $this->tagClose('div', 2);
+ }
+
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'IPv4 ');
+ $this->outputString('
' . $data['ipv4'] . '
');
$this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'IPv6 ');
$this->outputString('
' . $ipv6 . '
');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'NS1');
- $this->tagClose('div');
- $this->colOpen('col-8');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'NS1 ');
$this->outputString('
' . $data['ns1'] . '
');
- $this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'NS2');
$this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'NS2 ');
$this->outputString('
' . $data['ns2'] . '
');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'SSH Port');
- $this->tagClose('div');
- $this->colOpen('col-8');
- $this->HTMLphrase('p', 'm-value', '
' . $data['ssh_port'] . '
');
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Bandwidth');
- $this->tagClose('div');
- $this->colOpen('col-8');
- $this->HTMLphrase('p', 'm-value', '' . $data['bandwidth'] . '
' . $data['bandwidth_type'] . '');
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Disk');
- $this->tagClose('div');
- $this->colOpen('col-8');
- $this->HTMLphrase('p', 'm-value', '' . $data['disk'] . '
' . $data['disk_type'] . '');
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Location');
- $this->tagClose('div');
- $this->colOpen('col-8');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'Location ');
$this->HTMLphrase('p', 'm-value', $data['location']);
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Provider');
$this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'Provider ');
$this->HTMLphrase('p', 'm-value', $data['provider']);
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'OS');
- $this->tagClose('div');
- $this->colOpen('col-8');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'OS ');
$this->HTMLphrase('p', 'm-value', $this->osIntToString($data['os']));
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Due in');
$this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'Due in ');
$this->HTMLphrase('p', 'm-value', '' . $this->processDueDate($data['server_id'], $data['term'], $data['next_dd']) . '
days');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-section-row', 'col-12 text-center');
- $this->HTMLphrase('p', 'm-section-text', 'CPU');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'Bandwidth ');
+ $this->HTMLphrase('p', 'm-value', '' . $data['bandwidth'] . '
' . $data['bandwidth_type'] . '');
+ $this->tagClose('div');
+ $this->colOpen('col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'SSH Port ');
+ $this->outputString('
' . $data['ssh_port'] . '
');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Amount');
- $this->tagClose('div');
- $this->colOpen('col-8');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'Disk ');
+ $this->HTMLphrase('p', 'm-value', '' . $data['disk'] . '
' . $data['disk_type'] . '');
+ $this->tagClose('div', 2);
+
+ $this->rowColOpen('row m-section-row', 'col-12 col-md-6');
+ $this->HTMLphrase('p', 'm-section-text text-center', 'CPU');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6');
+ $this->HTMLphrase('p', 'm-desc', 'Amount ');
$this->HTMLphrase('p', 'm-value', $data['cpu']);
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Frequency');
$this->tagClose('div');
- $this->colOpen('col-8');
- $this->HTMLphrase('p', 'm-value', $data['cpu_freq']);
+ $this->colOpen('col-12 col-md-6');
+ $this->HTMLphrase('p', 'm-desc', 'Frequency ');
+ $this->HTMLphrase('p', 'm-value', $data['cpu_freq'] . '
Mhz');
$this->tagClose('div', 2);
-
$this->rowColOpen('row m-row', 'col-12');
$this->outputString('
' . $data['cpu_type'] . '
');
- $this->tagClose('div', 2);
+ $this->tagClose('div', 3);
- $this->rowColOpen('row m-section-row', 'col-12 text-center');
- $this->outputString('
Ram
');
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Ram');
- $this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-12 col-md-6');
+ $this->outputString('
Ram
');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6');
+ $this->HTMLphrase('p', 'm-desc', 'Ram ');
$this->HTMLphrase('p', 'm-value', '' . $data['ram'] . '
' . $data['ram_type'] . '');
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-4');
- $this->HTMLphrase('p', 'm-desc', 'Swap');
$this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-12 col-md-6');
+ $this->HTMLphrase('p', 'm-desc', 'Swap ');
$this->HTMLphrase('p', 'm-value', '' . $data['swap'] . '
' . $data['swap_type'] . '');
- $this->tagClose('div', 2);
+ $this->tagClose('div', 4);
if ($has_yabs) {
$this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'GeekBench 5');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
+ $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'single: ');
$this->HTMLphrase('p', 'm-value', $data['gb5_single']);
$this->tagClose('div');
- $this->colOpen('col-4');
+ $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'multi: ');
$this->HTMLphrase('p', 'm-value', $data['gb5_multi']);
$this->tagClose('div');
- $this->colOpen('col-4');
+ $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'id: ');
$this->outputString('
' . $data['gb5_id'] . '
');
$this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 text-center');
- $this->HTMLphrase('p', 'm-section-text', 'Disk test');
+ $this->HTMLphrase('p', 'm-section-text', 'Disk tests');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-6');
+ $this->rowColOpen('row m-row', 'col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '4k: ');
$this->HTMLphrase('p', 'm-value', '' . $data['4k'] . '
' . $data['4k_type'] . '');
$this->tagClose('div');
- $this->colOpen('col-6');
+ $this->colOpen('col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '64k: ');
$this->HTMLphrase('p', 'm-value', '' . $data['64k'] . '
' . $data['64k_type'] . '');
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-row', 'col-6');
+ $this->tagClose('div');
+ $this->colOpen('col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '512k: ');
$this->HTMLphrase('p', 'm-value', '' . $data['512k'] . '
' . $data['512k_type'] . '');
$this->tagClose('div');
- $this->colOpen('col-6');
+ $this->colOpen('col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '1m: ');
$this->HTMLphrase('p', 'm-value', '' . $data['1m'] . '
' . $data['1m_type'] . '');
$this->tagClose('div', 2);
@@ -2328,63 +2334,67 @@ class idlers extends helperFunctions
$this->HTMLphrase('p', 'm-section-text', 'Pricing');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-12');
+ $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-value', '' . $data['price'] . '
' . $data['currency'] . ' ');
$this->HTMLphrase('p', 'm-value', $this->paymentTerm($data['term']));
+ $this->tagClose('div');
+ $this->colOpen('col-12 col-md-6 mm-col');
+ $this->HTMLphrase('p', 'm-desc', 'As USD per month: ');
+ $this->HTMLphrase('p', 'm-value', '$' . $data['usd_per_month'] . '');
$this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'Other');
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
+ $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Owned since');
$this->tagClose('div');
- $this->colOpen('col-8');
+ $this->colOpen('col-8 mm-col');
$this->HTMLphrase('p', 'm-value', $data['owned_since']);
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
+ $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Dedicated: ');
$this->tagClose('div');
- $this->colOpen('col-2');
+ $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['is_dedicated']));
$this->tagClose('div');
- $this->colOpen('col-4');
+ $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Dedi CPU: ');
$this->tagClose('div');
- $this->colOpen('col-2');
+ $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['is_cpu_dedicated']));
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
+ $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Is offer: ');
$this->tagClose('div');
- $this->colOpen('col-2');
+ $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['was_special']));
$this->tagClose('div');
- $this->colOpen('col-4');
+ $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'AES-NI: ');
$this->tagClose('div');
- $this->colOpen('col-2');
+ $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['aes_ni']));
$this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-4');
+ $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'VM-x/AMD-V: ');
$this->tagClose('div');
- $this->colOpen('col-2');
+ $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['amd_v']));
$this->tagClose('div');
- $this->colOpen('col-4');
+ $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Virt: ');
$this->tagClose('div');
- $this->colOpen('col-2');
+ $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $data['virt']);
$this->tagClose('div', 2);
if ($has_yabs && $has_st) {
$this->rowColOpen('row m-section-row', 'col-12 text-center');
- $this->HTMLphrase('p', 'm-section-text', 'Network test');
+ $this->HTMLphrase('p', 'm-section-text', 'Network tests');
$this->tagClose('div', 2);
$this->tagOpen('div', 'row');
$this->outputString('
');
@@ -2407,8 +2417,8 @@ class idlers extends helperFunctions
}
}
- $this->rowColOpen('row m-section-row', 'col-12 text-center');
- $this->htmlPhrase('p', 'm-section-text', 'Notes');
+ $this->rowColOpen('row m-section-row', 'col-12 col-md-6');
+ $this->htmlPhrase('p', 'm-section-text text-center', 'Notes');
$this->outputString("
");
- $this->tagClose('div', 2);
-
- $this->rowColOpen('row m-section-row', 'col-12 text-center');
- $this->HTMLphrase('p', 'm-section-text', 'Tags');
- $this->tagClose('div', 2);
- $this->rowColOpen('row m-row', 'col-12');
+ $this->tagClose('div');
+ $this->colOpen('col-12 col-md-6');
+ $this->HTMLphrase('p', 'm-section-text text-center', 'Tags');
$this->tagOpen('ul');
$tags_arr = explode(",", $data['tags']);
foreach ($tags_arr as $tag) {
@@ -2430,16 +2437,16 @@ class idlers extends helperFunctions
}
}
$this->tagClose('ul');
- $this->tagClose('div', 3);
+ $this->tagClose('div', 2);
if (file_exists("yabs/{$data['server_id']}.txt")) {
- $this->rowColOpen('row text-center', 'col-12 col-md-6');
+ $this->rowColOpen('row m-section-row text-center', 'col-12 col-md-6');
$this->outputString('
View YABs');
$this->tagClose('div');
$this->colOpen('col-12 col-md-6');
$this->outputString('
Close');
$this->tagClose('div', 2);
} else {
- $this->rowColOpen('row text-center', 'col-12');
+ $this->rowColOpen('row m-section-row text-center', 'col-12');
$this->outputString('
Close');
$this->tagClose('div', 2);
}
@@ -2557,6 +2564,15 @@ class idlers extends helperFunctions
$this->outputString('
');
$this->tagClose('div');
$this->tagOpen('div', 'modal-body');
+
+ $this->rowColOpen('row m-row', 'col-4');
+ $this->HTMLphrase('p', 'm-desc', 'Attached to');
+ $this->tagClose('div');
+ $this->colOpen('col-8');
+ $this->outputString('
' . $this->idToObjectName($data['attached_to']) . '
');
+ $this->tagClose('div', 2);
+
+
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'NS2');
$this->tagClose('div');
@@ -3088,10 +3104,38 @@ class idlers extends helperFunctions
protected function viewSwitcherIcon()
{
$this->rowColOpen('row text-center', 'col-12');
- $this->outputString('
');
+ if (self::DEFAULT_VIEW == 'CARDS') {
+ $this->outputString('
');
+ } else {
+ $this->outputString('
');
+ }
$this->tagClose('div', 2);
}
+ protected function idToObjectName(string $id)
+ {//Returns a hostname or domain for an id
+ $servers = $this->dbConnect()->prepare("SELECT `hostname` FROM `servers` WHERE `id` = ? LIMIT 1;");
+ $servers->execute([$id]);
+ $servers_res = $servers->fetch(PDO::FETCH_ASSOC);
+ if ($servers_res) {
+ return $servers_res['hostname'];
+ } else {
+ $shared = $this->dbConnect()->prepare("SELECT `domain` FROM `shared_hosting` WHERE `id` = ? LIMIT 1;");
+ $shared->execute([$id]);
+ $shared_res = $shared->fetch(PDO::FETCH_ASSOC);
+ if ($shared_res) {
+ return $shared_res['domain'];
+ } else {
+ $domain = $this->dbConnect()->prepare("SELECT `domain` FROM `domains` WHERE `id` = ? LIMIT 1;");
+ $domain->execute([$id]);
+ $domain_res = $domain->fetch(PDO::FETCH_ASSOC);
+ if ($domain_res) {
+ return $domain_res['domain'];
+ }
+ }
+ }
+ return $id;
+ }
}
class itemInsert extends idlers
@@ -3114,10 +3158,11 @@ class itemInsert extends idlers
(isset($data['was_offer'])) ? $offer = 1 : $offer = 0;
(empty($data['ipv4'])) ? $ipv4 = null : $ipv4 = $data['ipv4'];
(empty($data['ipv6'])) ? $ipv6 = null : $ipv6 = $data['ipv6'];
+ (empty($data['label'])) ? $label = null : $label = $data['label'];
$location_id = $this->handleLocation($data['location']);
$provider_id = $this->handleProvider($data['provider']);
- $insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, has_yabs, ns1, ns2, ssh_port) VALUES (?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)');
- $insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['has_yabs'], $data['ns1'], $data['ns2'], $data['ssh_port']]);
+ $insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, has_yabs, ns1, ns2, ssh_port, label) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
+ $insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['has_yabs'], $data['ns1'], $data['ns2'], $data['ssh_port'], $label]);
$this->insertPrice($data['price'], $data['currency'], $data['term'], $data['next_due_date']);
return $item_id;
}
@@ -3131,13 +3176,14 @@ class itemInsert extends idlers
(isset($data['was_offer'])) ? $offer = 1 : $offer = 0;
(empty($data['ipv4'])) ? $ipv4 = null : $ipv4 = $data['ipv4'];
(empty($data['ipv6'])) ? $ipv6 = null : $ipv6 = $data['ipv6'];
+ (empty($data['label'])) ? $label = null : $label = $data['label'];
($data['ram_type'] == 'GB') ? $ram_mb = $this->GBtoMB($data['ram']) : $ram_mb = $data['ram'];
($data['swap_type'] == 'GB') ? $swap_mb = $this->GBtoMB($data['swap']) : $swap_mb = $data['swap'];
($data['disk_type'] == 'TB') ? $disk_gb = $this->TBtoGB($data['disk']) : $disk_gb = $data['disk'];
$location_id = $this->handleLocation($data['location']);
$provider_id = $this->handleProvider($data['provider']);
- $insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, cpu, cpu_freq, ram, ram_type, swap, swap_type, disk, disk_type, ram_mb, swap_mb, disk_gb, ns1, ns2, ssh_port) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
- $insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['cpu_amount'], $data['cpu_speed'], $data['ram'], $data['ram_type'], $data['swap'], $data['swap_type'], $data['disk'], $data['disk_type'], $ram_mb, $swap_mb, $disk_gb, $data['ns1'], $data['ns2'], $data['ssh_port']]);
+ $insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, cpu, cpu_freq, ram, ram_type, swap, swap_type, disk, disk_type, ram_mb, swap_mb, disk_gb, ns1, ns2, ssh_port, label) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
+ $insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['cpu_amount'], $data['cpu_speed'], $data['ram'], $data['ram_type'], $data['swap'], $data['swap_type'], $data['disk'], $data['disk_type'], $ram_mb, $swap_mb, $disk_gb, $data['ns1'], $data['ns2'], $data['ssh_port'], $label]);
$this->insertPrice($data['price'], $data['currency'], $data['term'], $data['next_due_date']);
return $item_id;
}
@@ -3317,8 +3363,8 @@ class itemUpdate extends idlers
} elseif ($data['me_non_active'] == 'on') {
$this->updateActiveStatus(0);
}
- $update = $this->dbConnect()->prepare("UPDATE `servers` SET `hostname` = ?,`ipv4` = ?,`ipv6` = ?,`cpu` = ?,`bandwidth` = ?,`disk` = ?,`ram` = ?,`ram_type` = ?,`swap` = ?,`swap_type` = ?, `virt` = ?, `tags` = ?, `owned_since` = ?, `ns1` = ?, `ns2` = ?, `ssh_port` = ?, `notes` = ? WHERE `id`= ? LIMIT 1;");
- return $update->execute([$data['me_hostname'], $data['me_ipv4'], $data['me_ipv6'], $data['me_cpu_amount'], $data['me_bandwidth'], $data['me_disk'], $data['me_ram'], $data['me_ram_type'], $data['me_swap'], $data['me_swap_type'], $data['me_virt'], $data['me_tags'], $data['me_owned_since'], $data['me_ns1'], $data['me_ns2'], $data['me_ssh_port'], $data['me_notes'], $this->item_id]);
+ $update = $this->dbConnect()->prepare("UPDATE `servers` SET `hostname` = ?,`ipv4` = ?,`ipv6` = ?,`cpu` = ?,`bandwidth` = ?,`disk` = ?,`ram` = ?,`ram_type` = ?,`swap` = ?,`swap_type` = ?, `virt` = ?, `tags` = ?, `owned_since` = ?, `ns1` = ?, `ns2` = ?, `ssh_port` = ?, `notes` = ?, `label` = ? WHERE `id`= ? LIMIT 1;");
+ return $update->execute([$data['me_hostname'], $data['me_ipv4'], $data['me_ipv6'], $data['me_cpu_amount'], $data['me_bandwidth'], $data['me_disk'], $data['me_ram'], $data['me_ram_type'], $data['me_swap'], $data['me_swap_type'], $data['me_virt'], $data['me_tags'], $data['me_owned_since'], $data['me_ns1'], $data['me_ns2'], $data['me_ssh_port'], $data['me_notes'], $data['me_label'], $this->item_id]);
}
public function updateServerPricingFromModal()
@@ -3357,8 +3403,9 @@ class itemUpdate extends idlers
} elseif ($data['d_me_non_active'] == 'on') {
$this->updateActiveStatus(0);
}
- $update = $this->dbConnect()->prepare("UPDATE `domains` SET `domain` = ?,`ns1` = ?,`ns2` = ?,`owned_since` = ? WHERE `id`= ? LIMIT 1;");
- return $update->execute([$data['d_me_hostname'], $data['d_me_ns1'], $data['d_me_ns2'], $data['d_me_owned_since'], $this->item_id]);
+ (!empty($_POST['d_me_attached_to'])) ? $attached_to = $_POST['d_me_attached_to'] : $attached_to = null;
+ $update = $this->dbConnect()->prepare("UPDATE `domains` SET `domain` = ?,`ns1` = ?,`ns2` = ?,`owned_since` = ?, `attached_to` = ? WHERE `id`= ? LIMIT 1;");
+ return $update->execute([$data['d_me_hostname'], $data['d_me_ns1'], $data['d_me_ns2'], $data['d_me_owned_since'], $attached_to, $this->item_id]);
}
public function updateDomainPricingFromModal()
diff --git a/my_idlers.sql b/my_idlers.sql
index c02df60..2003731 100644
--- a/my_idlers.sql
+++ b/my_idlers.sql
@@ -292,6 +292,7 @@ CREATE TABLE IF NOT EXISTS `servers`
(
`id` char(8) NOT NULL,
`hostname` varchar(124) DEFAULT NULL,
+ `label` varchar(24) DEFAULT NULL,
`location` int(11) DEFAULT NULL,
`provider` int(11) DEFAULT NULL,
`ipv4` varchar(124) DEFAULT NULL,
diff --git a/update.sql b/update.sql
deleted file mode 100644
index ad8b414..0000000
--- a/update.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-ALTER TABLE `disk_speed`
- ADD COLUMN `datetime` DATETIME NULL DEFAULT CURRENT_TIMESTAMP AFTER `1m_as_mbps`;
-
-ALTER TABLE `servers`
- ADD COLUMN `ssh_port` INT(11) NULL DEFAULT '22' AFTER `os`;
-
-ALTER TABLE `servers`
- ADD COLUMN `notes` VARCHAR(255) NULL DEFAULT NULL AFTER `tags`;
-
-ALTER TABLE `disk_speed`
- DROP PRIMARY KEY;
-
-ALTER TABLE `disk_speed`
- ADD UNIQUE INDEX `Index 1` (`server_id`, `datetime`);
-
-ALTER TABLE `servers`
- ADD COLUMN `has_st` TINYINT(1) NULL DEFAULT '0' AFTER `has_yabs`;
-
-UPDATE servers t1
- JOIN
- (
- SELECT server_id
- FROM speed_tests
- GROUP BY server_id
- HAVING COUNT(*) > 0
- ) t2
- ON t1.id = t2.server_id
-SET t1.has_st = 1;
-
-ALTER TABLE `servers`
- CHANGE COLUMN `bandwidth` `bandwidth` FLOAT NULL DEFAULT NULL AFTER `disk_type`;
\ No newline at end of file
diff --git a/update1.2to1.3.sql b/update1.2to1.3.sql
new file mode 100644
index 0000000..4f2d849
--- /dev/null
+++ b/update1.2to1.3.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `servers`
+ ADD COLUMN `label` VARCHAR(24) NULL DEFAULT NULL AFTER `hostname`;
\ No newline at end of file