106 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
|     /*****************************************************************************
 | |
|     IP Reg, a PHP/MySQL IPAM tool
 | |
|     Copyright (C) 2007-2009 Wietse Warendorff
 | |
| 
 | |
|     This program is free software: you can redistribute it and/or modify
 | |
|     it under the terms of the GNU General Public License as published by
 | |
|     the Free Software Foundation, either version 3 of the License, or
 | |
|     (at your option) any later version.
 | |
| 
 | |
|     This program is distributed in the hope that it will be useful,
 | |
|     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |
|     GNU General Public License for more details.
 | |
| 
 | |
|     You should have received a copy of the GNU General Public License
 | |
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |
| 
 | |
|     For more information, visit http://sourceforge.net/projects/ipreg,
 | |
|     or contact me at wietsew@users.sourceforge.net
 | |
|     *****************************************************************************/
 | |
| 
 | |
|     // start page
 | |
|         // includes
 | |
|         include("includes.php");
 | |
| 
 | |
|         // get id
 | |
|         $node_id = sanitize($_GET['node_id']);
 | |
| 
 | |
|         // start output
 | |
|         include("header.php");
 | |
| 
 | |
|         // set language variables
 | |
|         $smarty->assign($lang);
 | |
| 
 | |
|     // setup node
 | |
|         // build query
 | |
|         $query = "SELECT
 | |
|                 asset.asset_id,
 | |
|                 asset.asset_name,
 | |
|                 node.node_id,
 | |
|                 node.node_ip,
 | |
|                 node.node_mac,
 | |
|                 node.node_dns1,
 | |
|                 node.node_dns2,
 | |
|                 node.node_info,
 | |
|                 node.node_type,
 | |
|                 subnet.subnet_id,
 | |
|                 subnet.subnet_address,
 | |
|                 subnet.subnet_mask,
 | |
|                 zone.zone_origin
 | |
|             FROM
 | |
|                 node
 | |
|                 JOIN asset USING (asset_id)
 | |
|                 JOIN subnet USING (subnet_id)
 | |
|                 LEFT JOIN zone USING (zone_id)
 | |
|             WHERE
 | |
|                 node.node_id=" . $node_id;
 | |
| 
 | |
|         // run query
 | |
|         $node = $db->db_select($query);
 | |
|         $node[0]['node_mac'] = write_mac($node[0]['node_mac']);
 | |
|         $smarty->assign("node", $node[0]);
 | |
| 
 | |
|     // setup nat
 | |
|         // build query
 | |
|         $query = "SELECT
 | |
|                 asset_ext.asset_id AS asset_id_ext,
 | |
|                 asset_int.asset_id AS asset_id_int,
 | |
|                 asset_ext.asset_name AS asset_name_ext,
 | |
|                 asset_int.asset_name AS asset_name_int,
 | |
|                 nat.nat_id AS nat_id,
 | |
|                 nat.nat_type AS nat_type,
 | |
|                 nat.nat_ext AS nat_ext,
 | |
|                 nat.nat_int AS nat_int,
 | |
|                 node_ext.node_ip AS node_ip_ext,
 | |
|                 node_int.node_ip AS node_ip_int
 | |
|             FROM
 | |
|                 asset asset_ext,
 | |
|                 asset asset_int,
 | |
|                 nat,
 | |
|                 node node_ext,
 | |
|                 node node_int
 | |
|             WHERE
 | |
|                 (nat.nat_ext=" . $node_id . "
 | |
|                 OR nat.nat_int=" . $node_id . ")
 | |
|                 AND node_ext.node_id=nat.nat_ext
 | |
|                 AND node_int.node_id=nat.nat_int
 | |
|                 AND asset_ext.asset_id=node_ext.asset_id
 | |
|                 AND asset_int.asset_id=node_int.asset_id
 | |
|             ORDER BY
 | |
|                 INET_ATON(node_ext.node_ip),
 | |
|                 INET_ATON(node_int.node_ip)";
 | |
| 
 | |
|         // run query
 | |
|         $natrules = $db->db_select($query);
 | |
|         // counter to tpl
 | |
|         $smarty->assign("natrules", $natrules);
 | |
| 
 | |
|     // end page
 | |
|         // output
 | |
|         $smarty->display("nodeview.tpl");
 | |
| 
 | |
|         include("footer.php");
 | |
| ?>
 |