editport.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
  5. if (isset($_POST["editport"])) {
  6. $new['snmp_index'] = $_POST["f_snmp"] * 1;
  7. $new['uplink'] = $_POST["f_uplink"] * 1;
  8. $new['nagios'] = $_POST["f_nagios"] * 1;
  9. $new['skip'] = $_POST["f_skip"] * 1;
  10. $new['comment'] = $_POST["f_comment"];
  11. update_record($db_link, "device_ports", "id='$id'", $new);
  12. $target_id = $_POST["f_target_port"];
  13. bind_ports($db_link, $id, $target_id);
  14. // redirect to device
  15. $device_id = get_record_field($db_link,'device_ports','device_id',"id=".$id);
  16. header("location: switchport.php?id=$device_id");
  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. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  22. ?>
  23. <div id="cont">
  24. <form name="def" action="editport.php?id=<? echo $id; ?>" method="post">
  25. <table class="data">
  26. <tr>
  27. <td>id</td>
  28. <td>Порт</td>
  29. <td>snmp</td>
  30. <td>Комментарий</td>
  31. <td>Device</td>
  32. <td>Uplink</td>
  33. <td>Nagios</td>
  34. <td>Не проверять</td>
  35. </tr>
  36. <?php
  37. print "<td class=\"data\"><input type=hidden name=\"id\" value=".$id.">".$id."</td>\n";
  38. print "<td class=\"data\"><input type=\"text\" name='f_port' value='".$port['port']."'></td>\n";
  39. print "<td class=\"data\"><input type=\"text\" name='f_snmp' value='".$port['snmp_index']."'></td>\n";
  40. print "<td class=\"data\"><input type=\"text\" name='f_comment' value='".$port['comment']."'></td>\n";
  41. print "<td class=\"data\">";
  42. print_device_port_select($db_link, 'f_target_port', $device_id, $port['target_port_id']);
  43. print "</td>\n";
  44. print "<td class=\"data\">";
  45. print_qa_select('f_uplink', $port['uplink']);
  46. print "</td>\n";
  47. print "<td class=\"data\">";
  48. print_qa_select('f_nagios', $port['nagios']);
  49. print "</td>\n";
  50. print "<td class=\"data\">";
  51. print_qa_select('f_skip', $port['skip']);
  52. print "</td>\n";
  53. ?>
  54. </tr>
  55. <tr><td colspan=2><input type="submit" name="editport" value="Сохранить"></td></tr>
  56. </table>
  57. </form>
  58. <?
  59. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  60. ?>