// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// 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; version 2
// 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, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require("include/config.php");
if (comprueba_login() == 0)
$id_user = $_SESSION["id_usuario"];
else
$id_user = "";
if (give_acl($id_user, 0, "PM")!=1) {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to access SNMP Group Management");
require ("general/noaccess.php");
exit;
}
if (isset($_GET["create"])){ // Create module
$name = entrada_limpia ($_POST["name"]);
$parent = entrada_limpia ($_POST["parent"]);
$sql_insert="INSERT INTO tnetwork_component_group (name,parent)
VALUES ('$name', '$parent')";
$result=mysql_query($sql_insert);
if (! $result)
echo "
".$lang_label["create_no"]."
";
else {
echo "".$lang_label["create_ok"]."
";
$id_sg = mysql_insert_id();
}
}
if (isset($_GET["update"])){ // if modified any parameter
$id_sg = entrada_limpia ($_GET["id_sg"]);
$name = entrada_limpia ($_POST["name"]);
$parent = entrada_limpia ($_POST["parent"]);
$sql_update ="UPDATE tnetwork_component_group
SET name = '$name', parent = '$parent'
WHERE id_sg = '$id_sg'";
$result=mysql_query($sql_update);
if (! $result)
echo "".$lang_label["modify_no"]."
";
else
echo "".$lang_label["modify_ok"]."
";
}
if (isset($_GET["delete"])){ // if delete
$id_sg = entrada_limpia ($_GET["id_sg"]);
$sql_delete= "DELETE FROM tnetwork_component_group WHERE id_sg = ".$id_sg;
$result=mysql_query($sql_delete);
if (! $result)
echo "".$lang_label["delete_no"]."
";
else
echo "".$lang_label["delete_ok"]."
";
$result=mysql_query($sql_delete);
}
echo "".$lang_label["module_management"]." > ";
echo $lang_label["network_component_group_management"]."
";
echo "";
echo "".$lang_label["name"]." | ";
echo "".$lang_label["parent"]." | ";
echo "".$lang_label["delete"]." | ";
$sql1='SELECT * FROM tnetwork_component_group ORDER BY parent';
$result=mysql_query($sql1);
$color=0;
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "
".$row["name"]."
|
".give_network_component_group_name ($row["parent"])."
|
|
";
}
echo "
";
echo '";
?>