parent
7cfcaeb9d7
commit
78b97c5094
@ -1,29 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$node_ip = sanitize($_GET['node_ip']); |
||||
$subnet_id = sanitize($_GET['subnet_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask |
||||
FROM subnet |
||||
WHERE subnet_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$subnet_id]); |
||||
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ)); |
||||
$smarty->assign("node_ip", $node_ip); |
||||
|
||||
$smarty->display("assigniptonode.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,28 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$asset_id = sanitize($_GET['asset_id']); |
||||
$node_ip = sanitize($_GET['node_ip']); |
||||
$subnet_id = sanitize($_GET['subnet_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$smarty->assign("node_ip", $node_ip); |
||||
$smarty->assign("asset_id", $asset_id); |
||||
$smarty->assign("subnet_id", $subnet_id); |
||||
|
||||
$smarty->assign("asset_options", db_get_options_asset()); |
||||
$smarty->assign("subnet_options", db_get_options_subnet()); |
||||
|
||||
$smarty->display("assignnodetoasset.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,22 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
include("header.php"); |
||||
|
||||
|
||||
$comments = sanitize($_GET['comments']); |
||||
|
||||
$smarty->assign("comments", $lang['lang_comments_' . $comments]); |
||||
|
||||
$smarty->display("comments.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,75 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_parent = sanitize($_GET['location_parent']); |
||||
|
||||
include("header.php"); |
||||
|
||||
|
||||
// ************* <option value="0">{$lang_option_none}</option> |
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name, |
||||
location_parent AS parent, location_sort AS sort |
||||
FROM location |
||||
ORDER BY location_parent, location_sort, location_name"; |
||||
$sth = $dbh->query($sql); |
||||
$locations = $sth->fetchAll(); |
||||
|
||||
if (count($locations) > 0) { |
||||
foreach ($locations AS $location) { |
||||
$location_names[$location['id']] = $location['name']; |
||||
$parents[$location['parent']][] = $location['id']; |
||||
} |
||||
} |
||||
|
||||
// look for parents |
||||
// function to look for parents and create a new array for every child |
||||
function location($parents, $parent = 0) { |
||||
foreach ($parents[$parent] as $child) { |
||||
if (isset($parents[$child])) { |
||||
// element has children |
||||
$children[$child] = location($parents, $child); |
||||
} else { |
||||
// no children, set NULL |
||||
$children[$child] = NULL; |
||||
} |
||||
} |
||||
return $children; |
||||
} |
||||
|
||||
// recursive children check to template |
||||
function checkchildren($locations, $level) { |
||||
global $location_options; |
||||
global $location_names; |
||||
global $location_parent; |
||||
|
||||
foreach ($locations as $parent=>$child) { |
||||
$row = str_repeat("- ", $level) . $location_names[$parent]; |
||||
$location_options[$parent] = $row; |
||||
if (isset($child)) { |
||||
checkchildren($child, $level+1); |
||||
} |
||||
} |
||||
} |
||||
|
||||
$tree = location($parents); |
||||
|
||||
// create tree option list |
||||
$location_options = array(0 => '-'); |
||||
checkchildren($tree, 0); |
||||
|
||||
$smarty->assign("location_options", $location_options); |
||||
$smarty->assign("location_parent", $location_parent); |
||||
|
||||
$smarty->display("locationadd.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,24 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_id = sanitize($_GET['location_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name FROM location WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
$smarty->display("locationdel.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,98 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_id = sanitize($_GET['location_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
// location |
||||
$sql = "SELECT location_id AS id, location_name AS name, location_parent AS parent, |
||||
location_info AS info, location_sort AS sort |
||||
FROM location |
||||
WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$location = $sth->fetch(PDO::FETCH_OBJ); |
||||
|
||||
$location_parent = $location->parent; |
||||
|
||||
$smarty->assign("location", $location); |
||||
|
||||
/*$smarty->assign("location_id", $location_id); |
||||
$smarty->assign("location_name", $location[0]['location_name']); |
||||
$smarty->assign("location_info", $location[0]['location_info']); |
||||
$smarty->assign("location_sort", $location[0]['location_sort']); */ |
||||
|
||||
// parent location |
||||
$sql = "SELECT location_id, location_name, location_parent |
||||
FROM location |
||||
WHERE location_id != ? |
||||
ORDER BY location_name"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
|
||||
$locations = $sth->fetchAll(); |
||||
|
||||
$location_counter = count($locations); |
||||
|
||||
$smarty->assign("location_counter", $location_counter); |
||||
|
||||
// any loactions? |
||||
if ($location_counter>0) { |
||||
foreach($locations AS $location) { |
||||
$location_names[$location['location_id']] = $location['location_name']; |
||||
$parents[$location['location_parent']][] = $location['location_id']; |
||||
} |
||||
} |
||||
|
||||
// look for parents |
||||
// function to look for parents and create a new array for every child |
||||
function location($parents, $parent = 0) { |
||||
// loop array to check |
||||
foreach($parents[$parent] as $child) { |
||||
if(isset($parents[$child])) { |
||||
// element has children |
||||
$children[$child] = location($parents, $child); |
||||
} else { |
||||
// no children, set NULL |
||||
$children[$child] = NULL; |
||||
} |
||||
} |
||||
|
||||
// and again... |
||||
return $children; |
||||
} |
||||
|
||||
// recursive children check to template |
||||
function checkchildren($locations, $level) { |
||||
global $location_options; |
||||
global $location_names; |
||||
global $location_parent; |
||||
|
||||
foreach ($locations as $parent=>$child) { |
||||
$row = str_repeat("- ", $level) . $location_names[$parent]; |
||||
$location_options[$parent] = $row; |
||||
if(isset($child)) { |
||||
checkchildren($child, $level+1); |
||||
} |
||||
} |
||||
} |
||||
|
||||
$tree = location($parents); |
||||
$location_options = array(0 => '-'); |
||||
checkchildren($tree, 0); |
||||
$smarty->assign("location_options", $location_options); |
||||
$smarty->assign("location_parent", $location_parent); |
||||
|
||||
$smarty->display("locationedit.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,28 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_id = sanitize($_GET['location_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name |
||||
FROM location |
||||
WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
$smarty->assign("subnet_options", db_get_options_subnet()); |
||||
|
||||
$smarty->display("locationsubnetadd.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,44 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_id = sanitize($_GET['location_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
// location |
||||
$sql = "SELECT location_id AS id, location_name AS name |
||||
FROM location |
||||
WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
|
||||
// subnet |
||||
$sql = "SELECT |
||||
s.subnet_id, |
||||
s.subnet_address, |
||||
s.subnet_mask |
||||
FROM |
||||
subnetlocation AS l LEFT JOIN subnet AS s USING (subnet_id) |
||||
WHERE |
||||
l.location_id=? |
||||
ORDER BY |
||||
INET_ATON(s.subnet_address)"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
|
||||
$smarty->assign($sth->fetchAll()); |
||||
|
||||
$smarty->display("locationsubnetdel.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,26 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_id = sanitize($_GET['location_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name |
||||
FROM location |
||||
WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
$smarty->display("locationsubnetedit.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,67 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$location_id = sanitize($_GET['location_id']); |
||||
if ((isset($_GET['id'])) ? $id = sanitize($_GET['id']) : $id = ''); |
||||
|
||||
include("header.php"); |
||||
|
||||
|
||||
// base location |
||||
$sql = "SELECT location_id AS id, location_name AS name, |
||||
location_parent AS parent_id, location_info AS info, |
||||
CONCAT('locationview.php?location_id=', location_id) AS url |
||||
FROM location |
||||
WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$location = $sth->fetch(PDO::FETCH_OBJ); |
||||
$smarty->assign("location", $location); |
||||
|
||||
// crumbs |
||||
$crumbs[] = $location; |
||||
$sql = "SELECT location_id AS id, location_name AS name, |
||||
location_parent AS parent_id, |
||||
CONCAT('locationview.php?location_id=', location_id) AS url |
||||
FROM location |
||||
WHERE location_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
while ($crumbs[0]->parent_id != 0) { |
||||
$sth->execute([$crumbs[0]->parent_id]); |
||||
$result = $sth->fetch(PDO::FETCH_OBJ); |
||||
array_unshift($crumbs, $result); |
||||
} |
||||
$smarty->assign("crumbs", $crumbs); |
||||
|
||||
// sublocations |
||||
$sql = "SELECT location_id AS sublocation_id, location_name AS sublocation_name, |
||||
LEFT(location_info, 40) AS info_short, |
||||
CHAR_LENGTH(location_info) AS info_length |
||||
FROM location |
||||
WHERE location_parent=? |
||||
ORDER BY location_name"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$smarty->assign("sublocations", $sth->fetchAll()); |
||||
|
||||
// subnets |
||||
$sql = "SELECT s.subnet_id, s.subnet_address, s.subnet_mask |
||||
FROM subnet AS s LEFT JOIN subnetlocation AS l USING (subnet_id) |
||||
WHERE l.location_id=? |
||||
ORDER BY INET_ATON(s.subnet_address)"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$location_id]); |
||||
$smarty->assign("subnets", $sth->fetchAll()); |
||||
|
||||
$smarty->display("locationview.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,65 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$node_id = sanitize($_GET['node_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
// node_ext |
||||
$sql = "SELECT node_ip AS node_ip_ext |
||||
FROM node |
||||
WHERE node_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id]); |
||||
|
||||
$node = $sth->fetch(PDO::FETCH_OBJ); |
||||
|
||||
$smarty->assign("node_id_ext", $node_id); |
||||
$smarty->assign("node_ip_ext", $node->node_ip_ext); |
||||
|
||||
// node_int |
||||
$sql = "SELECT |
||||
a.asset_name, |
||||
n.node_id AS node_id_int, |
||||
n.node_ip AS node_ip_int |
||||
FROM |
||||
asset AS a LEFT JOIN node AS n USING (asset_id) |
||||
WHERE |
||||
n.node_id NOT IN ( |
||||
SELECT |
||||
nat_int |
||||
FROM |
||||
nat |
||||
WHERE |
||||
nat_ext=? |
||||
) |
||||
AND n.node_id!=? |
||||
ORDER BY |
||||
INET_ATON(n.node_ip)"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id, $node_id]); |
||||
|
||||
$nodes = $sth->fetchAll(); |
||||
|
||||
foreach ($nodes as $rec) { |
||||
$node_options[$rec['node_id_int']] = $rec['node_ip_int'] . '/' . $rec['asset_name']; |
||||
} |
||||
$smarty->assign("node_options", $node_options); |
||||
|
||||
$nat_type_options[1] = $lang['lang_nat_type_1']; |
||||
$nat_type_options[2] = $lang['lang_nat_type_2']; |
||||
$nat_type_options[3] = $lang['lang_nat_type_3']; |
||||
$smarty->assign("nat_type_options", $nat_type_options); |
||||
|
||||
$smarty->display("natadd.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,40 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$node_id = sanitize($_GET['node_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
// node_ext |
||||
$sth = $dbh->prepare("SELECT node_id AS id_ext, node_ip AS ip_ext FROM node WHERE node_id=?"); |
||||
$sth->execute([$node_id]); |
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
// options |
||||
$sql = "SELECT x.nat_id, n.node_ip, a.asset_name |
||||
FROM nat AS x |
||||
LEFT JOIN node AS n ON (x.nat_int=n.node_id) |
||||
LEFT JOIN asset AS a USING (asset_id) |
||||
WHERE x.nat_ext=? |
||||
ORDER BY INET_ATON(n.node_ip)"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id]); |
||||
$nats = $sth->fetchAll(); |
||||
|
||||
$options = array(); |
||||
foreach ($nats as $rec) { |
||||
$options[$rec['nat_id']] = $rec['node_ip'] . '/' . $rec['asset_name']; |
||||
} |
||||
$smarty->assign("nat_options", $options); |
||||
$smarty->display("natdel.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,24 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$node_id = sanitize($_GET['node_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip FROM node WHERE node.node_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id]); |
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
$smarty->display("natedit.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,27 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
if ((isset($_GET['node_ip'])) ? $node_ip = sanitize($_GET['node_ip']) : $node_ip = ''); |
||||
if ((isset($_GET['subnet_id'])) ? $subnet_id = sanitize($_GET['subnet_id']) : $subnet_id = ''); |
||||
|
||||
include("header.php"); |
||||
|
||||
$smarty->assign("user_dns1suffix", $_SESSION['suser_dns1suffix']); |
||||
$smarty->assign("user_dns2suffix", $_SESSION['suser_dns2suffix']); |
||||
$smarty->assign("node_ip", $node_ip); |
||||
$smarty->assign("subnet_id", $subnet_id); |
||||
|
||||
$smarty->assign("subnet_options", db_get_options_subnet()); |
||||
$smarty->assign("assetclass_options", db_get_options_assetclass()); |
||||
$smarty->display("nodeadd.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,24 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$node_id = sanitize($_GET['node_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip, asset_id FROM node WHERE node_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id]); |
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
$smarty->display("nodedel.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,32 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
$node_id = sanitize($_GET['node_id']); |
||||
|
||||
include("header.php"); |
||||
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip, node_mac AS mac, |
||||
node_dns1 AS dns1, node_dns2 AS dns2, node_info AS info, |
||||
zone_id, asset_id, subnet_id |
||||
FROM node |
||||
WHERE node_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id]); |
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ)); |
||||
|
||||
$smarty->assign("asset_options", db_get_options_asset()); |
||||
$smarty->assign("subnet_options", db_get_options_subnet()); |
||||
$smarty->assign("zone_options", db_get_options_zone('(keine)')); |
||||
|
||||
$smarty->display("nodeedit.tpl"); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,89 +0,0 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
IP Reg, a PHP/MySQL IPAM tool |
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5) |
||||
Copyright (C) 2011-2023 Thomas Hooge |
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later |
||||
*****************************************************************************/ |
||||
|
||||
include("includes.php"); |
||||
|
||||
if (isset($_GET['node_id']) && (!empty($_GET['node_id']))) { |
||||
$node_id = sanitize($_GET['node_id']); |
||||
} else { |
||||
// redirect to error page |
||||
header_location("comments.php?comments=error"); |
||||
exit; |
||||
} |
||||
|
||||
include("header.php"); |
||||
|
||||
// node |
||||
$sql = "SELECT |
||||
asset.asset_id, |
||||
asset.asset_name, |
||||
node.node_id AS id, |
||||
node.node_ip AS ip, |
||||
node.node_mac AS mac, |
||||
node.node_dns1 AS dns1, |
||||
node.node_dns2 AS dns2, |
||||
node.node_info AS info, |
||||
node.node_type AS type, |
||||
subnet.subnet_id, |
||||
subnet.subnet_address, |
||||
subnet.subnet_mask, |
||||
zone.zone_origin |
||||
FROM |
||||
node |
||||
LEFT JOIN asset USING (asset_id) |
||||
LEFT JOIN subnet USING (subnet_id) |
||||
LEFT JOIN zone USING (zone_id) |
||||
WHERE |
||||
node.node_id=?"; |
||||
$sth = $dbh->prepare($sql); |
||||
$sth->execute([$node_id]); |
||||
|
||||
$node = $sth->fetch(PDO::FETCH_OBJ); |
||||
$node->mac = write_mac($node->mac); |
||||
$smarty->assign("node", $node); |
||||
|
||||
// nat |
||||
$sql = "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, |
||||
node_int.node_id AS node_id_int, |
||||
node_ext.node_id AS node_id_ext |
||||
FROM |
||||
asset AS asset_ext, |
||||
asset AS asset_int, |
||||
nat, |
||||
node AS node_ext, |
||||
node AS node_int |
||||
WHERE |
||||
(nat.nat_ext=:node_id OR nat.nat_int=:node_id) |
||||