editfilter.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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["editfilter"])) {
  6. $new['name'] = $_POST["f_name"];
  7. $new['dst'] = $_POST["f_dst"];
  8. $new['proto'] = $_POST["f_proto"];
  9. $new['dstport'] = str_replace(':', '-', $_POST["f_dstport"]);
  10. $new['srcport'] = str_replace(':', '-', $_POST["f_srcport"]);
  11. $new['action'] = $_POST["f_action"] * 1;
  12. $new['comment'] = $_POST["f_comment"];
  13. update_record($db_link, "Filter_list", "id='$id'", $new);
  14. unset($_POST);
  15. header("Location: " . $_SERVER["REQUEST_URI"]);
  16. exit;
  17. }
  18. unset($_POST);
  19. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  20. $filter = get_record($db_link, 'Filter_list','id='.$id);
  21. print_filters_submenu($page_url);
  22. print "<div id=cont>";
  23. print "<br> <b>".WEB_title_filter."</b> <br>";
  24. print "<form name=def action='editfilter.php?id=".$id."' method=post>";
  25. print "<input type=hidden name=id value=$id>";
  26. if (isset($filter['type']) and $filter['type'] == 0) {
  27. print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
  28. print "<tr><td><b>".WEB_cell_forename."</b></td>";
  29. print "<td ><b>".WEB_cell_comment."</b></td>";
  30. print "<td ><b>".WEB_traffic_action."</b></td>";
  31. print "</tr>";
  32. print "<tr>";
  33. print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
  34. print "<td ><input type=text name=f_comment value='".$filter['comment']."'></td>";
  35. print "<td>";
  36. print_action_select('f_action', $filter['action']);
  37. print "</td>";
  38. print "<td><input type=submit name=editfilter value='".WEB_btn_save."'></td>";
  39. print "</tr>";
  40. print "<tr>";
  41. print "<td ><b>".WEB_traffic_proto."</b></td>";
  42. print "<td ><b>".WEB_traffic_dest_address."</b></td>";
  43. print "<td ><b>".WEB_traffic_dst_port."</b></td>";
  44. print "<td ><b>".WEB_traffic_src_port."</b></td>";
  45. print "</tr>";
  46. print "<tr>";
  47. print "<td ><input type=text name=f_proto value='".$filter['proto']."'></td>";
  48. print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
  49. print "<td ><input type=text name=f_dstport value='".$filter['dstport']."'></td>";
  50. print "<td ><input type=text name=f_srcport value='".$filter['srcport']."'></td>";
  51. print "</tr>";
  52. print "</table>";
  53. } else {
  54. print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
  55. print "<tr><td><b>".WEB_cell_forename."</b></td>";
  56. print "<td ><b>".WEB_cell_comment."</b></td>";
  57. print "<td ><b>".WEB_traffic_action."</b></td>";
  58. print "<td><input type=submit name=editfilter value=".WEB_btn_save."></td>";
  59. print "</tr>";
  60. print "<tr>";
  61. print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
  62. print "<td ><input type=text name=f_comment value='".$filter['comment']."'></td>";
  63. print "<td>";
  64. print_action_select('f_action', $filter['action']);
  65. print "</td>";
  66. print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
  67. print "</td>";
  68. print_action_select('f_action', $filter['action']);
  69. print "</td>";
  70. print "</tr>";
  71. print "</table>";
  72. }
  73. print "</form>";
  74. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  75. ?>