<?php
	include("header.php");
	
	// get id
	$node_id = $_GET['node_id'];
	
	// get node info
	$result = mysql_query("SELECT a.asset_name, a.asset_id, n.ip, n.mac, n.dns1, n.dns2, n.node_info, s.subnet_id, s.subnet_address, s.subnet_mask FROM asset a, node n, subnet s WHERE n.node_id='$node_id' AND a.asset_id=n.asset_id AND s.subnet_id=n.subnet_id");
	while ($row = mysql_fetch_object($result)) {
		$asset_id = $row->asset_id;
		$asset_name = $row->asset_name;
		$ip = $row->ip;
		$mac = write_mac($row->mac);
		$dns1 = $row->dns1;
		$dns2 = $row->dns2;
		$node_info = $row->node_info;
		$subnet_id = $row->subnet_id;
		$subnet_address = $row->subnet_address;
		$subnet_mask = $row->subnet_mask;
	}
?>
	
	<table border="0">
		<tr>
			<td>
				<b>IP Address:</b>
			</td>
			<td>
				<?php echo $ip; ?>
			</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 colspan="2">&nbsp;</td></tr>
		<tr>
			<td>
				<b>Asset name:</b>
			</td>
			<td>
				<a href="assetview.php?asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></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="nodeedit.php?node_id=<?php echo $node_id; ?>">Modify node</a>
			</td>
		</tr>
		<tr>
			<td>
				<img src="images/arrow.gif" border="0"><a href="nodedel.php?node_id=<?php echo $node_id; ?>">Delete node</a>
			</td>
		</tr>
	</table>
	
<?php
	// end display only if admin
	}
		
	include("footer.php");
?>