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/assetview.php

158 lines
3.2 KiB

<?php
include("header.php");
// get id
$asset_id = $_GET['asset_id'];
// get asset info
$result = mysql_query("SELECT a.asset_name, a.hostname, a.asset_info, ac.assetclass_id, ac.assetclass_name FROM asset a, assetclass ac WHERE a.asset_id='$asset_id' AND ac.assetclass_id=a.assetclass_id");
while ($row = mysql_fetch_object($result)) {
$asset_name = $row->asset_name;
$hostname = $row->hostname;
$asset_info = $row->asset_info;
$assetclass_id = $row->assetclass_id;
$assetclass_name = $row->assetclass_name;
}
?>
<table border="0">
<tr>
<td>
<b>Asset name:</b>
</td>
<td>
<?php echo $asset_name; ?>
</td>
</tr>
<tr>
<td>
<b>Hostname:</b>
</td>
<td>
<?php echo $hostname; ?>
</td>
</tr>
<tr>
<td>
<b>Asset class:</b>
</td>
<td>
<a href="assetclassview.php?assetclass_id=<?php echo $assetclass_id; ?>"><?php echo $assetclass_name; ?></a>
</td>
</tr>
<tr>
<td>
<b>Asset info:</b>
</td>
<td>
<?php echo nl2br($asset_info); ?>
</td>
</tr>
</table>
<?php
// get node info
$nodecount=0;
$result = mysql_query("SELECT n.node_id, n.ip, n.mac, n.dns1, n.dns2, n.node_info, s.subnet_id, s.subnet_address, s.subnet_mask FROM node n, subnet s WHERE asset_id='$asset_id' AND s.subnet_id=n.subnet_id ORDER BY INET_ATON(n.ip)");
while ($row = mysql_fetch_object($result)) {
$node_id = $row->node_id;
$ip = $row->ip;
$mac = write_mac($row->mac);
$dns1 = $row->dns1;
$dns2 = $row->dns2;
$subnet_id = $row->subnet_id;
$node_info = $row->node_info;
$subnet_address = $row->subnet_address;
$subnet_mask = $row->subnet_mask;
$nodecount++;
?>
<p>
<table border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<b>Node #<?php echo $nodecount; ?></b>
</td>
</tr>
<tr>
<td>
<b>IP Address:</b>
</td>
<td>
<a href="nodeview.php?node_id=<?php echo $node_id; ?>"><?php echo $ip; ?></a>
</td>
</tr>
<tr>
<td>
<b>Subnet:</b>
</td>
<td>
<a href="subnetview.php?subnet_id=<?php echo $subnet_id; ?>&page=<?php echo page($ip); ?>"><?php echo $subnet_address; ?>/<?php echo $subnet_mask; ?></a>
</td>
</tr>
<tr>
<td>
<b>MAC Address:</b>
</td>
<td>
<?php echo $mac; ?>
</td>
</tr>
<tr>
<td>
<b>DNS name:</b>
</td>
<td>
<?php echo $dns1; ?>
</td>
</tr>
<tr>
<td>
<b>DNS alias:</b>
</td>
<td>
<?php echo $dns2; ?>
</td>
</tr>
<tr>
<td>
<b>Node info:</b>
</td>
<td>
<?php echo nl2br($node_info); ?>
</td>
</tr>
</table>
<?php
}
// display only if admin
if($_SESSION['suser_level'] >= 2) {
?>
<p>
<table border="0">
<tr>
<td>
<img src="images/arrow.gif" border="0"><a href="assetedit.php?asset_id=<?php echo $asset_id; ?>">Modify asset</a>
</td>
</tr>
<tr>
<td>
<img src="images/arrow.gif" border="0"><a href="assetdel.php?asset_id=<?php echo $asset_id; ?>">Delete asset</a>
</td>
</tr>
</table>
<?php
// end display only if admin
}
include("footer.php");
?>