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()"));
?>