$snmp], [$row['id']]); } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } // Сохранение ОТМЕЧЕННЫХ портов if (getPOST("save") !== null) { $selected_ids = getPOST("f_id", null, []); // отмеченные чекбоксы $all_ids = getPOST("p_id", null, []); // все ID $port_names = getPOST("f_name", null, []); $snmp_indices = getPOST("f_snmp_index", null, []); if (!empty($selected_ids) && is_array($selected_ids)) { $selected_ids = array_map('intval', $selected_ids); $selected_set = array_flip($selected_ids); foreach ($all_ids as $i => $id) { $id = (int)$id; if ($id <= 0 || !isset($selected_set[$id])) continue; $new = [ 'port_name' => trim($port_names[$i] ?? ''), 'snmp_index' => (int)($snmp_indices[$i] ?? 0) ]; update_record($db_link, "device_ports", "id = ?", $new, [$id]); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } unset($_POST); $device=get_record($db_link,'devices',"id=?", [$id]); $user_info = get_record_sql($db_link,"SELECT * FROM user_list WHERE id=?", [ $device['user_id'] ]); require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php"); print_device_submenu($page_url); print_editdevice_submenu($page_url,$id,$device['device_type'],$user_info['login']); ?>