Location: PHPKode > projects > Zonomania > zonomania202/zones/functions/unzone.php
<?php
// Datum: 28.04.10
// Author: Chrigi
// Version: 2.02
// File: unzone.php
//
// LICENSE
//    Copyright (C) 2007-2010 Chrigi
//    This file is part of Zonomania.
//
//    Zonomania 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.
//
//    Foobar 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 Zonomania.  If not, see <http://www.gnu.org/licenses/>.
//
// DESCRIPTION
//    Zonomania is a webbased application to document a SAN (Storage Area Network) environment.
//    It is powerful in the hand of a SAN Administrator to manage, engineer and plan a SAN.
// 
//    What before has been done with table sheets, can now be done with Zonomania.
//    Zonomania easily handles SAN servers, HBAs, zones, aliases, switches and LUNs. 
//    You always have an eye on firmware revisions, available switchports or fill levels of storage arrays.
//    With Zonomania you keep track of your configuration items manually and Zonomania verifies 
//    the documentation online with your SAN devices. It also draws performance graphs from EVAperf csv files. 
//
//    As for now Zonomania is designed for an HP EVA SAN environement.
//    Any enhancements, especially the integration of other storage systems, are welcome.
//
//
///////////////////////////////////////////////////////////////////////////////////////

include("../../var/config.php"); // configuration things
include("../../var/functions.php"); // function things
include("../../var/dbconnect.php"); // zur DB verbinden

$system_id = $_POST["system_id"];
$alias_id = $_POST["alias_id"];
$the_zone_id = $_POST["unzone_system"];

// System aus zone entfernen
///////////////////////////////////////////////////////////////////////////////////////
if ($system_id) {
	for ($i=0; $i < count($system_id); $i++) { // jedes ausgewählte Element aus der db entfernen
		$statement = "DELETE FROM zm_zosys WHERE zosys_id = '$system_id[$i]'";
		$doit = mysql_query($statement);
		if (!$doit) {
			error_log(date("M d H:i:s ")."### zones/functions/unzone.php FAILED SQL QUERY delete zosys: $statement\n", 3, $DEV_LOG_FILE);
			error_log(date("M d H:i:s ")."### zones/functions/unzone.php FAILED SQL ERROR: ".mysql_error()."\n", 3, $DEV_LOG_FILE);
		}
	}
}
// Alias aus zone entfernen
///////////////////////////////////////////////////////////////////////////////////////
if ($alias_id) {
	for ($i=0; $i < count($alias_id); $i++) { // jedes ausgewählte Element aus der db entfernen
		$statement = "DELETE FROM zm_alzo WHERE alzo_id = '$alias_id[$i]'";
		$doit = mysql_query($statement);
		if (!$doit) {
			error_log(date("M d H:i:s ")."### zones/functions/unzone.php FAILED SQL QUERY delete alzo: $statement\n", 3, $DEV_LOG_FILE);
			error_log(date("M d H:i:s ")."### zones/functions/unzone.php FAILED SQL ERROR: ".mysql_error()."\n", 3, $DEV_LOG_FILE);
		}
	}
}

if (!$system_id && !$alias_id) $error = 'unzone_prob';
else $error = 'unzone_ok';

mysql_close($db_connection); // Verbindung zur DB schliessen
header("Location: ../index.php?error_add=&error_del=$error&max=$the_zone_id#$the_zone_id");
?>
Return current item: Zonomania