-
DHCP Range / IPs
-
-
- Notes
-
-
-
-
diff --git a/client_networks.php b/client_networks.php
index c8a0cc91..63717dc2 100644
--- a/client_networks.php
+++ b/client_networks.php
@@ -16,7 +16,7 @@ $sql = mysqli_query(
LEFT JOIN locations ON location_id = network_location_id
WHERE network_client_id = $client_id
AND network_archived_at IS NULL
- AND (network_name LIKE '%$q%' OR network_description LIKE '%$q%' OR network_vlan LIKE '%$q%' OR network LIKE '%$q%' OR network_gateway LIKE '%$q%' OR network_dhcp_range LIKE '%$q%' OR location_name LIKE '%$q%')
+ AND (network_name LIKE '%$q%' OR network_description LIKE '%$q%' OR network_vlan LIKE '%$q%' OR network LIKE '%$q%' OR network_gateway LIKE '%$q%' OR network_subnet LIKE '%$q%' OR network_primary_dns LIKE '%$q%' OR network_secondary_dns LIKE '%$q%' OR network_dhcp_range LIKE '%$q%' OR location_name LIKE '%$q%')
ORDER BY $sort $order LIMIT $record_from, $record_to"
);
@@ -88,8 +88,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Name
vLAN
-
Network
+
IP / Network
Gateway
+
DNS
DHCP Range
Location
Action
@@ -103,13 +104,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$network_name = nullable_htmlentities($row['network_name']);
$network_description = nullable_htmlentities($row['network_description']);
$network_vlan = intval($row['network_vlan']);
- if (empty($network_vlan)) {
- $network_vlan_display = "-";
- } else {
+ if ($network_vlan) {
$network_vlan_display = $network_vlan;
+ } else {
+ $network_vlan_display = "-";
}
$network = nullable_htmlentities($row['network']);
+ $network_subnet = nullable_htmlentities($row['network_subnet']);
$network_gateway = nullable_htmlentities($row['network_gateway']);
+ $network_primary_dns = nullable_htmlentities($row['network_primary_dns']);
+ $network_secondary_dns = nullable_htmlentities($row['network_secondary_dns']);
+ if ($network_primary_dns && $network_secondary_dns) {
+ $network_dns_display = "$network_primary_dns
$network_secondary_dns
";
+ } else {
+ $network_dns_display = "-";
+ }
$network_dhcp_range = nullable_htmlentities($row['network_dhcp_range']);
if (empty($network_dhcp_range)) {
$network_dhcp_range_display = "-";
@@ -144,8 +153,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
+
+
+
+
+
diff --git a/database_updates.php b/database_updates.php
index 3bd5a3ed..eb4102db 100644
--- a/database_updates.php
+++ b/database_updates.php
@@ -1687,10 +1687,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.3'");
}
- // if (CURRENT_DATABASE_VERSION == '1.1.3') {
- // // Insert queries here required to update to DB version 1.1.4
+ if (CURRENT_DATABASE_VERSION == '1.1.3') {
+
+ mysqli_query($mysqli, "ALTER TABLE `networks` ADD `network_subnet` VARCHAR(200) DEFAULT NULL AFTER `network`");
+ mysqli_query($mysqli, "ALTER TABLE `networks` ADD `network_primary_dns` VARCHAR(200) DEFAULT NULL AFTER `network_gateway`");
+ mysqli_query($mysqli, "ALTER TABLE `networks` ADD `network_secondary_dns` VARCHAR(200) DEFAULT NULL AFTER `network_primary_dns`");
+ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.4'");
+ }
+
+ // if (CURRENT_DATABASE_VERSION == '1.1.4') {
+ // // Insert queries here required to update to DB version 1.1.5
// // Then, update the database to the next sequential version
- // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.4'");
+ // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.5'");
// }
} else {
diff --git a/database_version.php b/database_version.php
index 1760e835..62e7c706 100644
--- a/database_version.php
+++ b/database_version.php
@@ -5,5 +5,5 @@
* It is used in conjunction with database_updates.php
*/
-DEFINE("LATEST_DATABASE_VERSION", "1.1.3");
+DEFINE("LATEST_DATABASE_VERSION", "1.1.4");
diff --git a/js/network_edit_modal.js b/js/network_edit_modal.js
index f2ba62ca..217cc350 100644
--- a/js/network_edit_modal.js
+++ b/js/network_edit_modal.js
@@ -20,7 +20,10 @@ function populateNetworkEditModal(client_id, network_id) {
document.getElementById("editNetworkDescription").value = network.network_description;
document.getElementById("editNetworkVlan").value = network.network_vlan;
document.getElementById("editNetworkCidr").value = network.network;
+ document.getElementById("editNetworkSubnet").value = network.network_subnet;
document.getElementById("editNetworkGw").value = network.network_gateway;
+ document.getElementById("editNetworkPrimaryDNS").value = network.network_primary_dns;
+ document.getElementById("editNetworkSecondaryDNS").value = network.network_secondary_dns;
document.getElementById("editNetworkDhcp").value = network.network_dhcp_range;
document.getElementById("editNetworkNotes").value = network.network_notes;
diff --git a/post/network.php b/post/network.php
index 36bcbca7..338fc706 100644
--- a/post/network.php
+++ b/post/network.php
@@ -13,12 +13,15 @@ if (isset($_POST['add_network'])) {
$description = sanitizeInput($_POST['description']);
$vlan = intval($_POST['vlan']);
$network = sanitizeInput($_POST['network']);
+ $subnet = sanitizeInput($_POST['subnet']);
$gateway = sanitizeInput($_POST['gateway']);
+ $primary_dns = sanitizeInput($_POST['primary_dns']);
+ $secondary_dns = sanitizeInput($_POST['secondary_dns']);
$dhcp_range = sanitizeInput($_POST['dhcp_range']);
$notes = sanitizeInput($_POST['notes']);
$location_id = intval($_POST['location']);
- mysqli_query($mysqli,"INSERT INTO networks SET network_name = '$name', network_description = '$description', network_vlan = $vlan, network = '$network', network_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id, network_client_id = $client_id");
+ mysqli_query($mysqli,"INSERT INTO networks SET network_name = '$name', network_description = '$description', network_vlan = $vlan, network = '$network', network_subnet = '$subnet', network_gateway = '$gateway', network_primary_dns = '$primary_dns', network_secondary_dns = '$secondary_dns', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id, network_client_id = $client_id");
$network_id = mysqli_insert_id($mysqli);
@@ -40,13 +43,16 @@ if (isset($_POST['edit_network'])) {
$description = sanitizeInput($_POST['description']);
$vlan = intval($_POST['vlan']);
$network = sanitizeInput($_POST['network']);
+ $subnet = sanitizeInput($_POST['subnet']);
$gateway = sanitizeInput($_POST['gateway']);
+ $primary_dns = sanitizeInput($_POST['primary_dns']);
+ $secondary_dns = sanitizeInput($_POST['secondary_dns']);
$dhcp_range = sanitizeInput($_POST['dhcp_range']);
$notes = sanitizeInput($_POST['notes']);
$location_id = intval($_POST['location']);
$client_id = intval($_POST['client_id']);
- mysqli_query($mysqli,"UPDATE networks SET network_name = '$name', network_description = '$description', network_vlan = $vlan, network = '$network', network_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id WHERE network_id = $network_id");
+ mysqli_query($mysqli,"UPDATE networks SET network_name = '$name', network_description = '$description', network_vlan = $vlan, network = '$network', network_subnet = '$subnet', network_gateway = '$gateway', network_primary_dns = '$primary_dns', network_secondary_dns = '$secondary_dns', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id WHERE network_id = $network_id");
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Network', log_action = 'Modify', log_description = '$session_name modified network $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $network_id");
@@ -158,12 +164,12 @@ if (isset($_POST['export_client_networks_csv'])) {
$f = fopen('php://memory', 'w');
//set column headers
- $fields = array('Name', 'Description', 'vLAN', 'Network', 'Gateway', 'DHCP Range');
+ $fields = array('Name', 'Description', 'vLAN', 'IP/Network', 'Subnet Mask', 'Gateway', 'Primary DNS', 'Secondary DNS', 'DHCP Range');
fputcsv($f, $fields, $delimiter);
//output each row of the data, format line as csv and write to file pointer
while($row = $sql->fetch_assoc()) {
- $lineData = array($row['network_name'], $row['network_description'], $row['network_vlan'], $row['network'], $row['network_gateway'], $row['network_dhcp_range']);
+ $lineData = array($row['network_name'], $row['network_description'], $row['network_vlan'], $row['network'], $row['network_subnet'], $row['network_gateway'], $row['network_primary_dns'], $row['network_secondary_dns'], $row['network_dhcp_range']);
fputcsv($f, $lineData, $delimiter);
}