editfilter.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. $filter = get_record($db_link, 'filter_list','id=?', [ $id ]);
  6. if (getPOST("editfilter") !== null) {
  7. $new = [
  8. 'name' => trim(getPOST("f_name", null, $filter['name'])),
  9. 'dst' => trim(getPOST("f_dst", null, '')),
  10. 'proto' => trim(getPOST("f_proto", null, '')),
  11. 'dstport' => str_replace(':', '-', trim(getPOST("f_dstport", null, ''))),
  12. 'srcport' => str_replace(':', '-', trim(getPOST("f_srcport", null, ''))),
  13. 'description' => trim(getPOST("f_description", null, ''))
  14. ];
  15. update_record($db_link, "filter_list", "id = ?", $new, [$id]);
  16. header("Location: " . $_SERVER["REQUEST_URI"]);
  17. exit;
  18. }
  19. unset($_POST);
  20. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  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['filter_type']) and $filter['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 colspan=2><b>".WEB_cell_description."</b></td>";
  30. print "</tr>";
  31. print "<tr>";
  32. print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
  33. print "<td colspan=2><input type=text name=f_description value='".$filter['description']."' class='full-width'></td>";
  34. print "<td><input type=submit name=editfilter value='".WEB_btn_save."'></td>";
  35. print "</tr>";
  36. print "<tr>";
  37. print "<td ><b>".WEB_traffic_proto."</b></td>";
  38. print "<td ><b>".WEB_traffic_dest_address."</b></td>";
  39. print "<td ><b>".WEB_traffic_dst_port."</b></td>";
  40. print "<td ><b>".WEB_traffic_src_port."</b></td>";
  41. print "</tr>";
  42. print "<tr>";
  43. print "<td ><input type=text name=f_proto value='".$filter['proto']."'></td>";
  44. print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
  45. print "<td ><input type=text name=f_dstport value='".$filter['dstport']."'></td>";
  46. print "<td ><input type=text name=f_srcport value='".$filter['srcport']."'></td>";
  47. print "</tr>";
  48. print "</table>";
  49. } else {
  50. print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
  51. print "<tr><td><b>".WEB_cell_forename."</b></td>";
  52. print "<td><b>".WEB_cell_description."</b></td>";
  53. print "<td><input type=submit name=editfilter value=".WEB_btn_save."></td>";
  54. print "</tr>";
  55. print "<tr>";
  56. print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
  57. print "<td ><input type=text name=f_description value='".$filter['description']."'></td>";
  58. print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
  59. print "</tr>";
  60. print "</table>";
  61. }
  62. print "</form>";
  63. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");