$val) { if (isset($val)) { LOG_INFO($db_link, "Remove l3_interface id: $val"); delete_record($db_link, "device_l3_interfaces", "id=" . $val); } } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST['s_save'])) { $len = is_array($_POST['s_save']) ? count($_POST['s_save']) : 0; for ($i = 0; $i < $len; $i ++) { $save_id = intval($_POST['s_save'][$i]); $len_all = is_array($_POST['n_id']) ? count($_POST['n_id']) : 0; for ($j = 0; $j < $len_all; $j ++) { if (intval($_POST['n_id'][$j]) != $save_id) { continue; } $new['name'] = trim($_POST['s_name'][$j]); $new['interface_type'] = $_POST['s_type'][$j]*1; update_record($db_link, "device_l3_interfaces", "id='{$save_id}'", $new); } } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST["s_create"])) { if (!empty($_POST["s_create_name"])) { $new['name'] = trim($_POST["s_create_name"]); $new['device_id'] = $id; $new['interface_type'] = 0; LOG_INFO($db_link, "Create new l3_interface ".$new['name']." as local"); insert_record($db_link, "device_l3_interfaces", $new); } header("Location: " . $_SERVER["REQUEST_URI"]); } unset($_POST); require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php"); ?>