$snmp_val], [$row['id']]); } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } // Включение PoE if (getPOST("poe_on") !== null && $device['snmp_version'] > 0) { $poe_on = getPOST("poe_on", null, []); if (!empty($poe_on) && is_array($poe_on)) { foreach ($poe_on as $port_index) { $port_index = (int)$port_index; if ($port_index <= 0) continue; $port = get_record_sql($db_link, "SELECT port FROM device_ports WHERE device_id = ? AND snmp_index = ?", [$id, $port_index] ); if (!empty($port)) { LOG_DEBUG($db_link, "Device id: $id enable poe at port {$port['port']} snmp index $port_index"); set_port_poe_state($device['vendor_id'], $port['port'], $port_index, $device['ip'], $snmp, 1); } } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } // Отключение PoE if (getPOST("poe_off") !== null && $device['snmp_version'] > 0) { $poe_off = getPOST("poe_off", null, []); if (!empty($poe_off) && is_array($poe_off)) { foreach ($poe_off as $port_index) { $port_index = (int)$port_index; if ($port_index <= 0) continue; $port = get_record_sql($db_link, "SELECT port FROM device_ports WHERE device_id = ? AND snmp_index = ?", [$id, $port_index] ); if (!empty($port)) { LOG_DEBUG($db_link, "Device id: $id disable poe at port {$port['port']} snmp index $port_index"); set_port_poe_state($device['vendor_id'], $port['port'], $port_index, $device['ip'], $snmp, 0); } } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } // Включение портов if (getPOST("port_on") !== null && $device['snmp_version'] > 0) { $port_on = getPOST("port_on", null, []); if (!empty($port_on) && is_array($port_on)) { foreach ($port_on as $port_index) { $port_index = (int)$port_index; if ($port_index <= 0) continue; LOG_DEBUG($db_link, "Device id: $id enable port with snmp index $port_index"); set_port_state($device['vendor_id'], $port_index, $device['ip'], $snmp, 1); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } // Отключение портов if (getPOST("port_off") !== null && $device['snmp_version'] > 0) { $port_off = getPOST("port_off", null, []); if (!empty($port_off) && is_array($port_off)) { foreach ($port_off as $port_index) { $port_index = (int)$port_index; if ($port_index <= 0) continue; LOG_DEBUG($db_link, "Device id: $id disable port with snmp index $port_index"); set_port_state($device['vendor_id'], $port_index, $device['ip'], $snmp, 0); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } unset($_POST); if (!apply_device_lock($db_link, $id)) { header("Location: /admin/devices/editdevice.php?id=" . $id . "&status=locked"); exit; } $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']); ?>