From 9ef12f08b14da1c9ab9037123d36d9ed5ec36664 Mon Sep 17 00:00:00 2001 From: cp6 Date: Mon, 1 Feb 2021 14:06:57 +1100 Subject: [PATCH 1/7] Added YABs insert error handling & messages Makes possiblility of corrupt DB data less and wont go through with insert if conditions arent met. --- assets/js/scripts.min.js | 30 ++++++- calls.php | 11 ++- class.php | 185 +++++++++++++++++++++------------------ 3 files changed, 140 insertions(+), 86 deletions(-) diff --git a/assets/js/scripts.min.js b/assets/js/scripts.min.js index 4cb5c1b..cca35f3 100644 --- a/assets/js/scripts.min.js +++ b/assets/js/scripts.min.js @@ -18,6 +18,30 @@ jQuery Tags CUSTOM SCRIPTS/FUNCS */ +function YABSdebug(result){ + if (result == 1){ + return 'Success'; + } else if (result == 2){ + return 'Wrong version'; + } else if (result == 3){ + return 'Didnt start at right spot'; + } else if (result == 4){ + return 'Not correct format'; + } else if (result == 5){ + return 'Not a correct YABs command output'; + } else if (result == 6){ + return 'GeekBench 5 only allowed'; + } else if (result == 7){ + return 'GeekBench test failed'; + } else if (result == 8){ + return 'Didnt copy output correctly'; + } else if (result == 9){ + return 'Less than 50 lines'; + } else { + return 'Unknown '+result; + } +} + $(document).ready(function () { $("#yabsForm").submit(function (e) { e.preventDefault(e); @@ -26,7 +50,11 @@ $(document).ready(function () { url: "calls.php", data: $("#yabsForm").serialize(), success: function (result) { - location.reload(); + if (result.length == 1) { + alert('ERROR: ' + YABSdebug(result)); + } else { + location.reload(); + } } }); }); diff --git a/calls.php b/calls.php index 6e6c01f..3b66572 100644 --- a/calls.php +++ b/calls.php @@ -56,8 +56,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (isset($_POST['action']) && $_POST['action'] == 'insert') {//From an insert 'type' form $insert = new itemInsert($_POST); if (isset($_POST['from_yabs'])) {//From add form YABs - $insert->insertBasicWithYabs();//Insert basic data from form - $insert->insertYabsData();//Insert YABs data from the form + $id = $insert->insertBasicWithYabs();//Insert basic data from form + $response_code = $insert->insertYabsData();//Insert YABs data from the form + if ($response_code != 1) { + header('Content-Type: text/html; charset=utf-8'); + $update = new itemUpdate(array('me_server_id' => $id)); + $update->deleteObjectData(); + echo $response_code; + exit; + } } elseif (isset($_POST['manual'])) {//From add form manual $insert->insertBasic(); } elseif (isset($_POST['shared_hosting_form'])) {//From shared hosting form diff --git a/class.php b/class.php index c7cdbaf..bedd85b 100644 --- a/class.php +++ b/class.php @@ -3220,95 +3220,114 @@ class itemInsert extends idlers //echo json_encode($array); //exit; } - if (strpos($array[0], '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #') !== false || count($array) < 50) { + if (count($array) < 50){ + return 9;//Less than 50 lines + } + if (strpos($array[0], '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #') !== false) { + if ($array[1] == "\r"){ + return 8;//Didnt copy output correctly + } $version_array = explode(' ', preg_replace('!\s+!', ' ', $this->trimRemoveR($array[2]))); $version = $version_array[1];//YABs version - $cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': '))); - $cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz - $cpu_cores = $cpu_spec[1]; - $cpu_freq = $cpu_spec[3]; - $ram_line = $this->trimRemoveR(str_replace(':', '', strstr($array[14], ': '))); - $ram = floatval($ram_line); - $ram_type = $this->datatype($ram_line); - $swap_line = $this->trimRemoveR(str_replace(':', '', strstr($array[15], ': '))); - $swap = floatval($swap_line); - $swap_type = $this->datatype($swap_line); - $disk_line = $this->trimRemoveR(str_replace(':', '', strstr($array[16], ': '))); - $disk = floatval($disk_line); - $disk_type = $this->datatype($disk_line); - $io_3 = explode(' ', preg_replace('!\s+!', ' ', $array[24])); - $io_6 = explode(' ', preg_replace('!\s+!', ' ', $array[30])); - (strpos($array[12], 'Enabled') !== false) ? $aes_ni = 1 : $aes_ni = 0; - (strpos($array[13], 'Enabled') !== false) ? $vm_amd_v = 1 : $vm_amd_v = 0; - $d4k_as_mbps = $this->diskSpeedAsMbps($io_3[3], $this->floatValue($io_3[2])); - $d64k_as_mbps = $this->diskSpeedAsMbps($io_3[7], $this->floatValue($io_3[6])); - $d512k_as_mbps = $this->diskSpeedAsMbps($io_6[3], $this->floatValue($io_6[2])); - $d1m_as_mbps = $this->diskSpeedAsMbps($io_6[7], $this->floatValue($io_6[6])); - $disk_test_arr = array($this->item_id, $this->floatValue($io_3[2]), $io_3[3], $this->floatValue($io_3[6]), $io_3[7], $this->floatValue($io_6[2]), $io_6[3], $this->floatValue($io_6[6]), $io_6[7], $d4k_as_mbps, $d64k_as_mbps, $d512k_as_mbps, $d1m_as_mbps); - $this->insertDiskTest($disk_test_arr); - if ($array[45] == "Geekbench 5 Benchmark Test:\r") { - //No ipv6 - //Has short ipv4 network speed testing (-r) - $start_st = 36; - $end_st = 43; - $gb_s = 49; - $gb_m = 50; - $gb_url = 51; - } elseif ($array[40] == "Geekbench 5 Benchmark Test:\r") { - //No ipv6 - //Has full ipv4 network speed testing - $start_st = 36; - $end_st = 38; - $gb_s = 44; - $gb_m = 45; - $gb_url = 46; - } elseif ($array[40] == "iperf3 Network Speed Tests (IPv6):\r") { - //HAS ipv6 - //Has short ipv4 & ipv6 network speed testing - $start_st = 36; - $end_st = 38; - $gb_s = 52; - $gb_m = 53; - $gb_url = 54; - } elseif ($array[55] == "Geekbench 5 Benchmark Test:\r") { - //HAS ipv6 - //Has full ipv4 & ipv6 network speed testing - $start_st = 36; - $end_st = 43; - $gb_s = 59; - $gb_m = 60; - $gb_url = 61; - } - $geekbench_single = $this->intValue($array[$gb_s]); - $geekbench_multi = $this->intValue($array[$gb_m]); - $geek_full_url = explode(' ', preg_replace('!\s+!', ' ', $array[$gb_url])); - $gb5_id = substr($geek_full_url[3], strrpos($geek_full_url[3], '/') + 1);// - $has_a_speed_test = false; - for ($i = $start_st; $i <= $end_st; $i++) { - if (strpos($array[$i], 'busy') !== false) { - //Has a "busy" result, No insert + if ($version == 'v2020-12-29') { + $cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': '))); + $cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz + $cpu_cores = $cpu_spec[1]; + $cpu_freq = $cpu_spec[3]; + $ram_line = $this->trimRemoveR(str_replace(':', '', strstr($array[14], ': '))); + $ram = floatval($ram_line); + $ram_type = $this->datatype($ram_line); + $swap_line = $this->trimRemoveR(str_replace(':', '', strstr($array[15], ': '))); + $swap = floatval($swap_line); + $swap_type = $this->datatype($swap_line); + $disk_line = $this->trimRemoveR(str_replace(':', '', strstr($array[16], ': '))); + $disk = floatval($disk_line); + $disk_type = $this->datatype($disk_line); + $io_3 = explode(' ', preg_replace('!\s+!', ' ', $array[24])); + $io_6 = explode(' ', preg_replace('!\s+!', ' ', $array[30])); + (strpos($array[12], 'Enabled') !== false) ? $aes_ni = 1 : $aes_ni = 0; + (strpos($array[13], 'Enabled') !== false) ? $vm_amd_v = 1 : $vm_amd_v = 0; + $d4k_as_mbps = $this->diskSpeedAsMbps($io_3[3], $this->floatValue($io_3[2])); + $d64k_as_mbps = $this->diskSpeedAsMbps($io_3[7], $this->floatValue($io_3[6])); + $d512k_as_mbps = $this->diskSpeedAsMbps($io_6[3], $this->floatValue($io_6[2])); + $d1m_as_mbps = $this->diskSpeedAsMbps($io_6[7], $this->floatValue($io_6[6])); + $disk_test_arr = array($this->item_id, $this->floatValue($io_3[2]), $io_3[3], $this->floatValue($io_3[6]), $io_3[7], $this->floatValue($io_6[2]), $io_6[3], $this->floatValue($io_6[6]), $io_6[7], $d4k_as_mbps, $d64k_as_mbps, $d512k_as_mbps, $d1m_as_mbps); + $this->insertDiskTest($disk_test_arr); + if (isset($array[40])) { + if ($array[45] == "Geekbench 5 Benchmark Test:\r") { + //No ipv6 + //Has short ipv4 network speed testing (-r) + $start_st = 36; + $end_st = 43; + $gb_s = 49; + $gb_m = 50; + $gb_url = 51; + } elseif ($array[45] == "Geekbench 4 Benchmark Test:\r") { + return 6;//GeekBench 5 only allowed + } elseif ($array[45] == "Geekbench 5 test failed. Run manually to determine cause.") { + return 7;//GeekBench test failed + } elseif ($array[40] == "Geekbench 5 Benchmark Test:\r") { + //No ipv6 + //Has full ipv4 network speed testing + $start_st = 36; + $end_st = 38; + $gb_s = 44; + $gb_m = 45; + $gb_url = 46; + } elseif ($array[40] == "iperf3 Network Speed Tests (IPv6):\r") { + //HAS ipv6 + //Has short ipv4 & ipv6 network speed testing + $start_st = 36; + $end_st = 38; + $gb_s = 52; + $gb_m = 53; + $gb_url = 54; + } elseif ($array[55] == "Geekbench 5 Benchmark Test:\r") { + //HAS ipv6 + //Has full ipv4 & ipv6 network speed testing + $start_st = 36; + $end_st = 43; + $gb_s = 59; + $gb_m = 60; + $gb_url = 61; + } else { + return 5;//Not correct YABs command output + } } else { - $data = explode(' ', preg_replace('!\s+!', ' ', $array[$i])); - $send_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['send_type'], $this->yabsSpeedValues($data)['send']); - $recieve_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['receive_type'], $this->yabsSpeedValues($data)['receive']); - $insert = $this->dbConnect()->prepare('INSERT INTO `speed_tests` (`server_id`, `location`, `send`, `send_type`,`send_as_mbps`, `recieve`,`recieve_type`, `recieve_as_mbps`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'); - $insert->execute([$this->item_id, $this->yabsSpeedLoc($data)['location'], $this->yabsSpeedValues($data)['send'], $this->yabsSpeedValues($data)['send_type'], $send_as_mbps, $this->yabsSpeedValues($data)['receive'], $this->yabsSpeedValues($data)['receive_type'], $recieve_as_mbps]); - $has_a_speed_test = true; + return 4;//Not correct format } + $geekbench_single = $this->intValue($array[$gb_s]); + $geekbench_multi = $this->intValue($array[$gb_m]); + $geek_full_url = explode(' ', preg_replace('!\s+!', ' ', $array[$gb_url])); + $gb5_id = substr($geek_full_url[3], strrpos($geek_full_url[3], '/') + 1);// + $has_a_speed_test = false; + for ($i = $start_st; $i <= $end_st; $i++) { + if (strpos($array[$i], 'busy') !== false) { + //Has a "busy" result, No insert + } else { + $data = explode(' ', preg_replace('!\s+!', ' ', $array[$i])); + $send_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['send_type'], $this->yabsSpeedValues($data)['send']); + $recieve_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['receive_type'], $this->yabsSpeedValues($data)['receive']); + $insert = $this->dbConnect()->prepare('INSERT INTO `speed_tests` (`server_id`, `location`, `send`, `send_type`,`send_as_mbps`, `recieve`,`recieve_type`, `recieve_as_mbps`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'); + $insert->execute([$this->item_id, $this->yabsSpeedLoc($data)['location'], $this->yabsSpeedValues($data)['send'], $this->yabsSpeedValues($data)['send_type'], $send_as_mbps, $this->yabsSpeedValues($data)['receive'], $this->yabsSpeedValues($data)['receive_type'], $recieve_as_mbps]); + $has_a_speed_test = true; + } + } + if ($has_a_speed_test) { + $update_st = $this->dbConnect()->prepare('UPDATE `servers` SET `has_st` = 1 WHERE `id` = ? LIMIT 1;'); + $update_st->execute([$this->item_id]); + } + ($ram_type == 'GB') ? $ram_mb = $this->GBtoMB($ram) : $ram_mb = $ram; + ($swap_type == 'GB') ? $swap_mb = $this->GBtoMB($swap) : $swap_mb = $swap; + ($disk_type == 'TB') ? $disk_gb = $this->TBtoGB($disk) : $disk_gb = $disk; + $update = $this->dbConnect()->prepare('UPDATE `servers` SET `cpu` = ?, `cpu_freq` = ?, `cpu_type` = ?, ram = ?, ram_type = ?, swap = ?, swap_type = ?, disk = ?, disk_type = ?, `aes_ni` = ?, `amd_v` = ?, gb5_single = ?, gb5_multi = ?, gb5_id = ?, ram_mb = ?, swap_mb = ?, disk_gb = ? WHERE `id` = ? LIMIT 1;'); + $update->execute([$cpu_cores, $cpu_freq, $cpu, $ram, $ram_type, $swap, $swap_type, $disk, $disk_type, $aes_ni, $vm_amd_v, $geekbench_single, $geekbench_multi, $gb5_id, $ram_mb, $swap_mb, $disk_gb, $this->item_id]); + return 1; + } else { + return 2;//Wrong version } - if ($has_a_speed_test) { - $update_st = $this->dbConnect()->prepare('UPDATE `servers` SET `has_st` = 1 WHERE `id` = ? LIMIT 1;'); - $update_st->execute([$this->item_id]); - } - ($ram_type == 'GB') ? $ram_mb = $this->GBtoMB($ram) : $ram_mb = $ram; - ($swap_type == 'GB') ? $swap_mb = $this->GBtoMB($swap) : $swap_mb = $swap; - ($disk_type == 'TB') ? $disk_gb = $this->TBtoGB($disk) : $disk_gb = $disk; - $update = $this->dbConnect()->prepare('UPDATE `servers` SET `cpu` = ?, `cpu_freq` = ?, `cpu_type` = ?, ram = ?, ram_type = ?, swap = ?, swap_type = ?, disk = ?, disk_type = ?, `aes_ni` = ?, `amd_v` = ?, gb5_single = ?, gb5_multi = ?, gb5_id = ?, ram_mb = ?, swap_mb = ?, disk_gb = ? WHERE `id` = ? LIMIT 1;'); - $update->execute([$cpu_cores, $cpu_freq, $cpu, $ram, $ram_type, $swap, $swap_type, $disk, $disk_type, $aes_ni, $vm_amd_v, $geekbench_single, $geekbench_multi, $gb5_id, $ram_mb, $swap_mb, $disk_gb, $this->item_id]); - return true; } else { - //Not formatted right - return false; + return 3;//Didnt start at right spot } } From bdf013ce057191ca7a22f6514cd172739368be49 Mon Sep 17 00:00:00 2001 From: cp6 Date: Mon, 1 Feb 2021 14:12:49 +1100 Subject: [PATCH 2/7] Fixed attach domain too error when null Fixed attach domain too error when null and vieing more info modal --- class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/class.php b/class.php index bedd85b..04eb670 100644 --- a/class.php +++ b/class.php @@ -2569,7 +2569,11 @@ class idlers extends helperFunctions $this->HTMLphrase('p', 'm-desc', 'Attached to'); $this->tagClose('div'); $this->colOpen('col-8'); - $this->outputString('

' . $this->idToObjectName($data['attached_to']) . '

'); + if (!is_null($data['attached_to']) && !empty($data['attached_to'])){ + $this->outputString('

' . $this->idToObjectName($data['attached_to']) . '

'); + } else { + $this->outputString(''); + } $this->tagClose('div', 2); From e6fa1dc0ea1742193c76e5785d3f26968865eeaa Mon Sep 17 00:00:00 2001 From: cp6 Date: Mon, 1 Feb 2021 14:31:12 +1100 Subject: [PATCH 3/7] Added save YABs to file constant Added save YABs to file constant which was previously a function param --- class.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/class.php b/class.php index 04eb670..ac8ca51 100644 --- a/class.php +++ b/class.php @@ -19,6 +19,8 @@ class idlersConfig const COLOR_TABLE = true; const DEFAULT_VIEW = 'CARDS';//CARDS or TABLE + + const SAVE_YABS_OUTPUT = true;//true or false } class elementHelpers extends idlersConfig @@ -2569,7 +2571,7 @@ class idlers extends helperFunctions $this->HTMLphrase('p', 'm-desc', 'Attached to'); $this->tagClose('div'); $this->colOpen('col-8'); - if (!is_null($data['attached_to']) && !empty($data['attached_to'])){ + if (!is_null($data['attached_to']) && !empty($data['attached_to'])) { $this->outputString('

' . $this->idToObjectName($data['attached_to']) . '

'); } else { $this->outputString(''); @@ -3209,14 +3211,11 @@ class itemInsert extends idlers return $domain_id; } - public function insertYabsData(bool $save_yabs = true) + public function insertYabsData() {//YABS data handler $file_name = 'yabsFromForm.txt'; $logfile = fopen($file_name, "w") or die("Unable to open file!"); fwrite($logfile, $this->data['yabs']); - if ($save_yabs) { - $this->saveYABS($this->data['yabs'], "{$this->item_id}.txt"); - } fclose($logfile); $file = @fopen($file_name, 'r'); if ($file) { @@ -3224,11 +3223,11 @@ class itemInsert extends idlers //echo json_encode($array); //exit; } - if (count($array) < 50){ + if (count($array) < 50) { return 9;//Less than 50 lines } if (strpos($array[0], '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #') !== false) { - if ($array[1] == "\r"){ + if ($array[1] == "\r") { return 8;//Didnt copy output correctly } $version_array = explode(' ', preg_replace('!\s+!', ' ', $this->trimRemoveR($array[2]))); @@ -3326,6 +3325,9 @@ class itemInsert extends idlers ($disk_type == 'TB') ? $disk_gb = $this->TBtoGB($disk) : $disk_gb = $disk; $update = $this->dbConnect()->prepare('UPDATE `servers` SET `cpu` = ?, `cpu_freq` = ?, `cpu_type` = ?, ram = ?, ram_type = ?, swap = ?, swap_type = ?, disk = ?, disk_type = ?, `aes_ni` = ?, `amd_v` = ?, gb5_single = ?, gb5_multi = ?, gb5_id = ?, ram_mb = ?, swap_mb = ?, disk_gb = ? WHERE `id` = ? LIMIT 1;'); $update->execute([$cpu_cores, $cpu_freq, $cpu, $ram, $ram_type, $swap, $swap_type, $disk, $disk_type, $aes_ni, $vm_amd_v, $geekbench_single, $geekbench_multi, $gb5_id, $ram_mb, $swap_mb, $disk_gb, $this->item_id]); + if (self::SAVE_YABS_OUTPUT) { + $this->saveYABS($this->data['yabs'], "{$this->item_id}.txt"); + } return 1; } else { return 2;//Wrong version From ee8a193c18426d06787dfcd577af59996d258bc7 Mon Sep 17 00:00:00 2001 From: cp6 Date: Mon, 1 Feb 2021 14:46:37 +1100 Subject: [PATCH 4/7] Added delete saved YABs files when deleting server Delete saved YABs files when deleting server --- class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/class.php b/class.php index ac8ca51..b459e10 100644 --- a/class.php +++ b/class.php @@ -568,6 +568,20 @@ class helperFunctions extends elementHelpers $date = new DateTime($ahead_date); return $date->diff($today)->format("%a"); } + + protected function deleteYabsForId(string $id) + { + if ($handle = opendir("yabs/")) { + while (false !== ($file = readdir($handle))) { + if ('.' === $file) continue; + if (strpos($file, $id) !== false) { + unlink("yabs/$file"); + } + } + closedir($handle); + } + } + } class idlers extends helperFunctions @@ -3452,6 +3466,7 @@ class itemUpdate extends idlers $del_disk->execute([$item_id]); $del_speed = $this->dbConnect()->prepare("DELETE FROM `speed_tests` WHERE `server_id` = ?;"); $del_speed->execute([$item_id]); + $this->deleteYabsForId($item_id);//Delete saved YABs } } From 389a082fbc28d1ac9f3966bf42c736f5803097c5 Mon Sep 17 00:00:00 2001 From: cp6 Date: Tue, 2 Feb 2021 15:53:27 +1100 Subject: [PATCH 5/7] Added comapre servers section Ability to compare metrics between two servers --- assets/css/style.css | 28 ++++- assets/js/scripts.min.js | 29 +++++ calls.php | 3 + class.php | 239 ++++++++++++++++++++++++++++++++++++++- 4 files changed, 292 insertions(+), 7 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 5691985..fea7246 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -51,6 +51,9 @@ body { .container { max-width: 720px } + .nav-link { + padding: .5rem 0.45rem; + } } @media (min-width: 992px) { @@ -1184,10 +1187,27 @@ button.close { background: #00ff340f; } -.objects-table th:first-child, .objects-table td:first-child { +.objects-table th:first-child, .objects-table td:first-child, .compare-table th:first-child, .compare-table td:first-child { position: sticky; left: 0; background-color: #f6f6f6; + text-align: left; +} + +.compare-table td, .compare-table th { + text-align: center; +} + +.plus-td { + background: #71ed7136; +} + +.neg-td { + background: #ed827136; +} + +.equal-td { + background: #6189ff26; } .table-btn { @@ -1540,4 +1560,10 @@ input:checked + .slider:before { .modal-lg { max-width: 800px; } +} + +@media (max-width: 700px) { + .nav-link { + padding: 0.5rem 0.45rem; + } } \ No newline at end of file diff --git a/assets/js/scripts.min.js b/assets/js/scripts.min.js index cca35f3..99ab497 100644 --- a/assets/js/scripts.min.js +++ b/assets/js/scripts.min.js @@ -183,8 +183,37 @@ $(document).ready(function () { } else if ($("#tableViewDiv").hasClass("active")){ loadTable(); } + + //Compare section + $("#compare_s1").change(function () { + var server1_id = $("#compare_s1 option:selected").val(); + var server2_id = $("#compare_s2 option:selected").val(); + if (server2_id.length !== 0) { + compareTableCall(server1_id, server2_id); + } + }); + $("#compare_s2").change(function () { + var server2_id = $("#compare_s2 option:selected").val(); + var server1_id = $("#compare_s1 option:selected").val(); + if (server1_id.length !== 0) { + compareTableCall(server1_id, server2_id); + } + }); + }); +function compareTableCall(id1, id2) { + $("#compareTableDiv").empty(); + $.ajax({ + type: "GET", + url: "calls.php", + data: {"type": "compare_table", "server1": id1, "server2": id2}, + success: function (result) { + $("#compareTableDiv").append(result); + } + }); +} + function loadCards(){ $.ajax({ type: "GET", diff --git a/calls.php b/calls.php index 3b66572..b615b98 100644 --- a/calls.php +++ b/calls.php @@ -46,6 +46,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif ($_GET['type'] == 'object_tables') { header('Content-Type: text/html; charset=utf-8'); echo $idle->objectTables(); + } elseif ($_GET['type'] == 'compare_table') { + header('Content-Type: text/html; charset=utf-8'); + echo $idle->compareTable($_GET['server1'], $_GET['server2']); } } } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { diff --git a/class.php b/class.php index b459e10..020b023 100644 --- a/class.php +++ b/class.php @@ -612,7 +612,7 @@ class idlers extends helperFunctions protected function pageContents() { - $this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search'), array('#services', '#add_server', '#order', '#info', '#search')); + $this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search', 'Compare'), array('#services', '#add_server', '#order', '#info', '#search', '#compare')); $this->outputString('
'); $this->outputString('
'); $this->viewSwitcherIcon(); @@ -665,6 +665,10 @@ class idlers extends helperFunctions $this->outputString('