IP Reg is a IPAM tool to keep track of assets, nodes (IP addresses, MAC addresses, DNS aliases) within different subnets, over different locations or even VLAN's. Written in PHP, used with a MySQL-database to have a unique insight in your local network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
ipreg/nodelist.php

80 lines
2.0 KiB

<?php
include("header.php");
// get id
$subnet_id = $_GET['subnet_id'];
// get ordering
if (isset($_GET['order'])) {
$order = $_GET['order'];
} else {
$order = "INET_ATON(n.ip)";
}
?>
<table border="0">
<tr>
<td width="100">
<a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>&order=INET_ATON(n.ip)"><b>IP Address:</b></a>
</td>
<td width="150">
<a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>&order=a.asset_name"><b>Asset name:</b></a>
</td>
<td width="150">
<a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>&order=a.hostname"><b>Hostname:</b></a>
</td>
<td width="150">
<a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>&order=n.mac"><b>MAC Address:</b></a>
</td>
<td width="150">
<a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>&order=n.dns1"><b>DNS name:</b></a>
</td>
<td width="150">
<a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>&order=n.dns2"><b>DNS alias:</b></a>
</td>
</tr>
<?php
// get node info
$result = mysql_query("SELECT a.asset_id, a.asset_name, a.hostname, n.node_id, n.ip, n.mac, n.dns1, n.dns2 FROM asset a, node n WHERE n.subnet_id='$subnet_id' AND a.asset_id=n.asset_id ORDER BY $order");
while ($row = mysql_fetch_object($result)) {
$asset_id = $row->asset_id;
$asset_name = $row->asset_name;
$hostname = $row->hostname;
$node_id = $row->node_id;
$ip = $row->ip;
$mac = write_mac($row->mac);
$dns1 = $row->dns1;
$dns2 = $row->dns2;
?>
<tr>
<td>
<a href="nodeview.php?node_id=<?php echo $node_id; ?>"><?php echo $ip; ?></a>
</td>
<td>
<a href="assetview.php?asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
</td>
<td>
<?php echo $hostname; ?>
</td>
<td>
<?php echo $mac; ?>
</td>
<td>
<?php echo $dns1; ?>
</td>
<td>
<?php echo $dns2; ?>
</td>
</tr>
<?php
}
?>
</table>
<?php
include("footer.php");
?>