From 1381add82be7c88f9e7172607fc4d6d6c47ad6f3 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 25 Aug 2026 12:19:02 -0400 Subject: [PATCH] Feature: Added network IPs section to document network IP and their hostnames --- admin/database_updates/2.7.2.php | 27 ++ agent/modals/network/network_ip_add.php | 65 ++++ agent/modals/network/network_ip_edit.php | 70 +++++ agent/modals/network/network_ip_export.php | 38 +++ agent/modals/network/network_ip_import.php | 47 +++ agent/network.php | 291 ++++++++++++++++++ agent/networks.php | 19 +- agent/post/network_ip.php | 341 +++++++++++++++++++++ agent/post/network_ip_model.php | 9 + db.sql | 23 +- functions.php | 1 + functions/export.php | 10 + functions/network.php | 227 ++++++++++++++ 13 files changed, 1163 insertions(+), 5 deletions(-) create mode 100644 admin/database_updates/2.7.2.php create mode 100644 agent/modals/network/network_ip_add.php create mode 100644 agent/modals/network/network_ip_edit.php create mode 100644 agent/modals/network/network_ip_export.php create mode 100644 agent/modals/network/network_ip_import.php create mode 100644 agent/network.php create mode 100644 agent/post/network_ip.php create mode 100644 agent/post/network_ip_model.php create mode 100644 functions/network.php diff --git a/admin/database_updates/2.7.2.php b/admin/database_updates/2.7.2.php new file mode 100644 index 000000000..e984ef047 --- /dev/null +++ b/admin/database_updates/2.7.2.php @@ -0,0 +1,27 @@ + + +
+ + + + + +
+ + + +
+ + + + + +
+ + + + +
+ + + + + +
+ + + + +
+ + + + + +
+ +

Nothing to see here

Go Back"; + +} else { + + $row = mysqli_fetch_assoc($sql); + $client_id = intval($row['network_client_id']); + $client_name = escapeHtml($row['client_name']); + $network_name = escapeHtml($row['network_name']); + $network_description = escapeHtml($row['network_description']); + $network_vlan = intval($row['network_vlan']); + $network = escapeHtml($row['network']); + $network_gateway = escapeHtml($row['network_gateway']); + $network_primary_dns = escapeHtml($row['network_primary_dns']); + $network_secondary_dns = escapeHtml($row['network_secondary_dns']); + $network_dhcp_range = escapeHtml($row['network_dhcp_range']); + $network_notes = escapeHtml($row['network_notes']); + $location_name = escapeHtml($row['location_name']); + + // Belt and braces - the query above is already scoped, but the no-client_id + // entry point relies entirely on clientScopeSql() + enforceClientAccess(); + + // Sorting - the search box posts back through filter_header.php, which will + // accept any lowercase column name, so keep this to columns that exist + if (!in_array($sort, ['ip_address', 'ip_hostname', 'ip_description'], true)) { + $sort = 'ip_address'; + } + + // Addresses sort by value, not as text - .9 belongs before .10, and this is + // the one ordering that works for IPv4 and IPv6 in the same column + $order_by = ($sort === 'ip_address') ? "INET6_ATON(ip_address)" : $sort; + + $sql_ips = mysqli_query( + $mysqli, + "SELECT SQL_CALC_FOUND_ROWS ip_address, ip_description, ip_hostname, ip_id FROM network_ips + WHERE ip_network_id = $network_id + AND (ip_address LIKE '%$q%' OR ip_hostname LIKE '%$q%' OR ip_description LIKE '%$q%') + ORDER BY $order_by $order LIMIT $record_from, $record_to" + ); + + $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + + ?> + +
+ +
+ +
+
+ +

+ +
+ +
+
+
+ +
VLAN
+ +
+ +
+ +
+ +
+ +
+ + +
+
+ + +
+
+
Notes
+
+
+ +
+
+ + +
+ +
+ +
+
+

IP Addresses

+
+
+ + + +
+
+
+
+
+ + + + +
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ + + + "> + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + IP Address + + + + Hostname + + + + Description + + Action
+
+ +
+
+ + + + + +
+ +
+
+ +
+ +
+ +
+ + + + @@ -298,11 +300,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - +
-
+
+ + + + +
@@ -323,6 +330,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));