editfilter.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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["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. update_record($db_link, "Filter_list", "id='$id'", $new);
  13. unset($_POST);
  14. header("location: index.php");
  15. exit;
  16. }
  17. unset($_POST);
  18. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  19. $filter = get_record($db_link, 'Filter_list','id='.$id);
  20. print "<div id=cont>";
  21. print "<form name=def action=editfilter.php?id=$id method=post>";
  22. print "<input type=hidden name=id value=$id>";
  23. if (isset($filter['type']) and $filter['type'] == 0) {
  24. print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
  25. print "<tr><td><b>Имя</b></td>";
  26. print "<td ><b>Протокол</b></td>";
  27. print "<td ><b>Адрес назначения</b></td>";
  28. print "<td ><b>Порт назначения</b></td>";
  29. print "<td ><b>Порт источник</b></td>";
  30. print "<td ><b>Действие</b></td>";
  31. print "</tr><td align=left><input type=text name=f_name value=".$filter['name']."></td>";
  32. print "<td ><input type=text name=f_proto value=".$filter['proto']."></td>";
  33. print "<td ><input type=text name=f_dst value=".$filter['dst']."></td>";
  34. print "<td ><input type=text name=f_dstport value=".$filter['dstport']."></td>";
  35. print "<td ><input type=text name=f_srcport value=".$filter['srcport']."></td>";
  36. print "<td>";
  37. print_action_select('f_action', $filter['action']);
  38. print "</td></tr>";
  39. print "<tr><td colspan=2><input type=submit name=editfilter value=Сохранить></td>";
  40. print "</tr></table>";
  41. } else {
  42. print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
  43. print "<tr><td ><b>Имя</b></td>";
  44. print "<td ><b>Адрес назначения</b></td>";
  45. print "<td ><b>Действие</b></td></tr>";
  46. print "<td align=left><input type=text name=f_name value=".$filter['name']."></td>";
  47. print "<td ><input type=text name=f_dst value=".$filter['dst']."></td>";
  48. print_action_select('f_action', $filter['action']);
  49. print "<tr><td colspan=2><input type=submit name=editfilter value=Сохранить></td>";
  50. print "</tr></table>";
  51. }
  52. print "</form>";
  53. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  54. ?>