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

90 lines
2.0 KiB

<?php
include("header.php");
// get id
$location_id = $_GET['location_id'];
// get all info
$result = mysql_query("SELECT location_name, location_info FROM location WHERE location_id='$location_id'");
while ($row = mysql_fetch_object($result)) {
$location_info = $row->location_info;
}
?>
<table border="0">
<tr>
<td>
<b>Location name:</b>
</td>
<td>
<?php echo location_name($location_id, ''); ?>
</td>
</tr>
<tr>
<td>
<b>Location info:</b>
</td>
<td>
<?php echo nl2br($location_info); ?>
</td>
</tr>
<tr>
<td>
<b>Subnet(s):</b>
</td>
<td>
<?php
// search subnets for this location
$result = mysql_query("SELECT s.subnet_id, s.subnet_address, s.subnet_mask FROM subnet s INNER JOIN subnetlocation sl ON s.subnet_id=sl.subnet_id WHERE sl.location_id='$location_id'");
while ($row = mysql_fetch_object($result)) {
echo '<a href="subnetview.php?subnet_id='. $row->subnet_id . '">' . $row->subnet_address . '/' . $row->subnet_mask . '</a><br>';
}
?>
</td>
</tr>
<tr>
<td>
<b>Sub-location(s):</b>
</td>
<td>
<?php
// search sub-locations for this location
$result = mysql_query("SELECT location_id, location_name FROM location WHERE parent='$location_id' ORDER BY location_name");
while ($row = mysql_fetch_object($result)) {
echo '<a href="locationview.php?location_id='. $row->location_id . '">' . $row->location_name . '</a><br>';
}
?>
</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="locationedit.php?location_id=<?php echo $location_id; ?>">Modify location</a>
</td>
</tr>
<tr>
<td>
<img src="images/arrow.gif" border="0"><a href="assignlocationtosubnet.php?location_id=<?php echo $location_id; ?>">Assign subnet</a>
</td>
</tr>
</table>
<?php
// end display only if admin
}
include("footer.php");
?>