Location: PHPKode > scripts > eNetman > enetman-20050830/enetman/html/modules/02networkinterfaces/functions.php
<?

error_reporting(0);
foreach ($_POST as $varname => $varvalue) {
        $$varname = $varvalue;
}
foreach ($_GET as $varname => $varvalue) {
        $$varname = $varvalue;
}
foreach ($_SERVER as $varname => $varvalue) {
        $$varname = $varvalue;
}
if($debug) {
        error_reporting(1);
        error_reporting(E_ALL);
}

$REQUEST_METHOD = $_SERVER['REQUEST_METHOD'];
$action = $_POST['action'];
$ID = $_GET['ID'];
$page = $_GET['page'];
$view = $_GET['view'];

$Interface = $_POST['Interface'];
$MAC = $_POST['MAC'];
$IP = $_POST['IP'];
$Subnet = $_POST['Subnet'];
$Gateway = $_POST['Gateway'];
$DNS = $_POST['DNS'];
$networkcardType = $_POST['networkcardType'];

$thispath = $_GET['page'];
$lastslash = strrpos($thispath,"/");
$thispath = substr($thispath,0,$lastslash);

if(!$thispath) {
	$thispath = $_GET['thispath'];
}

if(!$action) {
	$action = $_GET['action'];
}

$action = split(",",$action);

if(($REQUEST_METHOD == "POST") || ($action[0] == "delete")) {

	switch($action[0]) {
		case "update" :
			switch($action[1]) {
                                case "port" :
                                        $query = "UPDATE ports SET Interface = \"$Interface\",MAC = \"$MAC\",IP = \"$IP\",";
                                        $query .= "Subnet = \"$Subnet\",Gateway = \"$Gateway\",DNS = \"$DNS\",";
                                        $query .= "networkcardType = $networkcardType WHERE ID=$action[2]";
                                        mysql_query($query);
                                        break;
			}
			break;
		case "add" :
			switch($action[1]) {
                                case "port" :
                                        $query = "INSERT INTO ports (serverID,Interface,MAC,IP,Subnet,Gateway,DNS,networkcardType) ";
                                        $query .= "VALUES ($ID,\"$Interface\",\"$MAC\",\"$IP\",\"$Subnet\",\"$Gateway\", ";
                                        $query .= "\"$DNS\",$networkcardType)";
                                        mysql_query($query);
                                        break;
			}
			break;
		case "delete" :
			switch($action[1]) {
				case "port" :
					$query = "SELECT serverID FROM ports WHERE ID = $action[2]";
					$result = mysql_query($query);
					$line = mysql_fetch_array($result);
					$sID = $line['serverID'];
					$query = "DELETE FROM openports WHERE sID = $sID";
					mysql_query($query);
                                        $query = "DELETE FROM ports WHERE ID = $action[2]";
                                        mysql_query($query);
                                        break;
                                case "server" :
                                        $query = "DELETE FROM ports WHERE serverID = $action[2]";
                                        mysql_query($query);
					break;
			}
			break;
	}
}

?>
Return current item: eNetman