1
0

editport.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
  5. if (isset($_POST["editport"])) {
  6. $new['port_name'] = trim($_POST["f_name"]);
  7. $new['snmp_index'] = $_POST["f_snmp"] * 1;
  8. $new['uplink'] = $_POST["f_uplink"] * 1;
  9. $new['nagios'] = $_POST["f_nagios"] * 1;
  10. $new['skip'] = $_POST["f_skip"] * 1;
  11. $new['comment'] = $_POST["f_comment"];
  12. update_record($db_link, "device_ports", "id='$id'", $new);
  13. $target_id = $_POST["f_target_port"];
  14. bind_ports($db_link, $id, $target_id);
  15. header("location: editport.php?id=$id");
  16. exit;
  17. }
  18. unset($_POST);
  19. $device_id = get_record_field($db_link,'device_ports','device_id',"id=".$id);
  20. $port = get_record($db_link, 'device_ports',"id=".$id);
  21. $device=get_record($db_link,'devices',"id=".$device_id);
  22. $user_info = get_record_sql($db_link,"SELECT * FROM User_list WHERE id=".$device['user_id']);
  23. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  24. print_device_submenu($page_url);
  25. print_editdevice_submenu($page_url,$device_id,$device['device_type'],$user_info['login']);
  26. ?>
  27. <div id="contsubmenu">
  28. <form name="def" action="editport.php?id=<?php echo $id; ?>" method="post">
  29. <table class="data">
  30. <tr align="center">
  31. <td width=20>id</td>
  32. <td width=40><?php echo WEB_device_port_number; ?></td>
  33. <td width=40><?php echo WEB_device_port_name; ?></td>
  34. <td width=40><?php echo WEB_device_port_snmp_index; ?></td>
  35. <td width=100>ifIndex</td>
  36. <td width=200><?php echo WEB_cell_comment; ?></td>
  37. <td width=100><?php echo WEB_device_port_uplink_device; ?></td>
  38. <td width=40><?php echo WEB_device_port_uplink; ?></td>
  39. <td width=40><?php echo WEB_nagios; ?></td>
  40. <td width=40><?php echo WEB_device_port_allien; ?></td>
  41. </tr>
  42. <?php
  43. print "<tr>";
  44. print "<td class=\"data\"><input type=hidden name=\"id\" value=".$id.">".$id."</td>\n";
  45. print "<td class=\"data\" align=center>".$port['port']."</td>\n";
  46. print "<td class=\"data\"><input type=\"text\" name='f_name' value='".$port['port_name']."' size=10></td>\n";
  47. print "<td class=\"data\"><input type=\"text\" name='f_snmp' value='".$port['snmp_index']."' size=10></td>\n";
  48. print "<td class=\"data\" align=center>".$port['ifName']."</td>\n";
  49. print "<td class=\"data\"><input type=\"text\" name='f_comment' value='".$port['comment']."' size=40></td>\n";
  50. print "<td class=\"data\">"; print_device_port_select($db_link, 'f_target_port', $device_id, $port['target_port_id']); print "</td>\n";
  51. print "<td class=\"data\">"; print_qa_select('f_uplink', $port['uplink']); print "</td>\n";
  52. print "<td class=\"data\">"; print_qa_select('f_nagios', $port['nagios']); print "</td>\n";
  53. print "<td class=\"data\">"; print_qa_select('f_skip', $port['skip']); print "</td>\n";
  54. ?>
  55. </tr>
  56. <tr><td colspan=2><input type="submit" name="editport" value="<?php echo WEB_btn_save; ?>"></td></tr>
  57. </table>
  58. </form>
  59. <?php
  60. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  61. ?>