diff --git a/client_networks.php b/client_networks.php
index 85c439d5..2ce8a88b 100644
--- a/client_networks.php
+++ b/client_networks.php
@@ -101,6 +101,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
while ($row = mysqli_fetch_array($sql)) {
$network_id = intval($row['network_id']);
$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 = "-";
@@ -131,11 +132,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
- )"
- data-target="#editNetworkModal">
+ |
+ )" data-target="#editNetworkModal">
+
-
+ |
|
|
|
diff --git a/js/network_edit_modal.js b/js/network_edit_modal.js
index f3716fb6..f2ba62ca 100644
--- a/js/network_edit_modal.js
+++ b/js/network_edit_modal.js
@@ -17,6 +17,7 @@ function populateNetworkEditModal(client_id, network_id) {
document.getElementById("editNetworkHeader").innerText = network.network_name;
document.getElementById("editNetworkId").value = network_id;
document.getElementById("editNetworkName").value = network.network_name;
+ document.getElementById("editNetworkDescription").value = network.network_description;
document.getElementById("editNetworkVlan").value = network.network_vlan;
document.getElementById("editNetworkCidr").value = network.network;
document.getElementById("editNetworkGw").value = network.network_gateway;
diff --git a/post/network.php b/post/network.php
index ca1e35ba..36bcbca7 100644
--- a/post/network.php
+++ b/post/network.php
@@ -10,6 +10,7 @@ if (isset($_POST['add_network'])) {
$client_id = intval($_POST['client_id']);
$name = sanitizeInput($_POST['name']);
+ $description = sanitizeInput($_POST['description']);
$vlan = intval($_POST['vlan']);
$network = sanitizeInput($_POST['network']);
$gateway = sanitizeInput($_POST['gateway']);
@@ -17,7 +18,7 @@ if (isset($_POST['add_network'])) {
$notes = sanitizeInput($_POST['notes']);
$location_id = intval($_POST['location']);
- mysqli_query($mysqli,"INSERT INTO networks SET network_name = '$name', 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_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id, network_client_id = $client_id");
$network_id = mysqli_insert_id($mysqli);
@@ -36,6 +37,7 @@ if (isset($_POST['edit_network'])) {
$network_id = intval($_POST['network_id']);
$name = sanitizeInput($_POST['name']);
+ $description = sanitizeInput($_POST['description']);
$vlan = intval($_POST['vlan']);
$network = sanitizeInput($_POST['network']);
$gateway = sanitizeInput($_POST['gateway']);
@@ -44,7 +46,7 @@ if (isset($_POST['edit_network'])) {
$location_id = intval($_POST['location']);
$client_id = intval($_POST['client_id']);
- mysqli_query($mysqli,"UPDATE networks SET network_name = '$name', 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_gateway = '$gateway', 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");
@@ -156,12 +158,12 @@ if (isset($_POST['export_client_networks_csv'])) {
$f = fopen('php://memory', 'w');
//set column headers
- $fields = array('Name', 'vLAN', 'Network', 'Gateway', 'DHCP Range');
+ $fields = array('Name', 'Description', 'vLAN', 'Network', 'Gateway', '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_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_gateway'], $row['network_dhcp_range']);
fputcsv($f, $lineData, $delimiter);
}