Files
itflow/agent/modals/network/network_ip_import.php
johnnyq 2fc9c7bfe3 Networks and asset interfaces modernization: networks list with type tiles and type filter pills, usage bars, subnet/gateway/DNS/DHCP at a glance, IP-contains search, bulk type/site/star/archive and type quick pick; network page with address plan (documented IPs and device interfaces merged, free runs with Use, DHCP band, gateway, next free IP, conflict/in-pool/MAC-mismatch/held-back/broadcast/outside-subnet flags), overlap notice, devices tab, inline notes, document device addresses, WAN provider details; network quick look; shared network form with icon input groups, type guessed from name, live CIDR info with gateway/DHCP suggestions and overlap check, validated on save (canonical CIDR, gateway and range inside subnet, DNS, VLAN 1-4094, client-owned site, client or own vendor as provider); documented IP types (fixed, DHCP reservation, held back, floating) with MAC, ranges up to 256, bulk type, import/export with type and MAC; asset interfaces moved to their own handler and form with network/IP validation and live check, next free, VLANs, one-to-one connections scoped to the client, disconnect, make primary, switch/firewall/AP port map, run-of-ports modal with preview and padding, ajax import/export with VLANs and connected to, bulk network/VLANs/type/DHCP/disconnect/delete; networks and IP addresses in global search with subnet containment and MAC normalization; location and service pages link networks; demo data with WAN networks tied to ISP vendors, reservations, held-back addresses and switch VLANs; alertMessageHtml no longer double-encodes; db update 2.8.9 adds network_type, network_vendor_id, ip_type, ip_mac, interface_vlans and indexes, backfills types and CIDR prefixes
2026-10-15 20:33:28 -04:00

48 lines
2.1 KiB
PHP

<?php
require_once '../../../includes/modal_header.php';
enforceUserPermission('module_support', 2);
$network_id = intval($_GET['network_id'] ?? 0);
$sql = mysqli_query($mysqli, "SELECT network, network_client_id, network_name FROM networks WHERE network_id = $network_id LIMIT 1");
$row = mysqli_fetch_assoc($sql);
$network_name = escapeHtml($row['network_name']);
$network = escapeHtml($row['network']);
$client_id = intval($row['network_client_id']);
enforceClientAccess();
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title"><i class="fas fa-fw fa-upload me-2"></i>Import IP Addresses</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="network_id" value="<?= $network_id ?>">
<div class="modal-body">
<p><strong>Format csv file with headings &amp; data:</strong><br>IP Address, Hostname, Description, Type, MAC <span class="text-secondary">(Type and MAC may be left off - an address is Static, Reservation, Reserved or Virtual)</span></p>
<p class="text-secondary mb-0">Importing into <strong><?= $network_name ?></strong> (<span class="font-monospace"><?= $network ?></span>). Rows that aren't a valid address, fall outside the subnet, or are already documented here are skipped.</p>
<hr>
<div class="mb-3 my-4">
<input type="file" class="form-control" name="file" accept=".csv" required>
</div>
<hr>
<div>Download: <a class="text-bold" href="post.php?download_network_ips_csv_template=<?= $network_id ?>">sample csv template</a></div>
</div>
<div class="modal-footer">
<button type="submit" name="import_network_ips_csv" class="btn btn-primary text-bold"><i class="fa fa-upload me-2"></i>Import</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
</div>
</form>
<?php
require_once '../../../includes/modal_footer.php';