index.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. if (isset($_POST["create"])) {
  5. $fname = $_POST["newfilter"];
  6. $ftype = 0;
  7. if (isset($_POST['filter_type'])) {
  8. $ftype = $_POST["filter_type"] * 1;
  9. }
  10. if (isset($fname)) {
  11. $new['name'] = $fname;
  12. $new['type'] = $ftype;
  13. $new_id=insert_record($db_link, "Filter_list", $new);
  14. header("Location: editfilter.php?id=$new_id");
  15. exit;
  16. }
  17. }
  18. if (isset($_POST["remove"])) {
  19. $fid = $_POST["fid"];
  20. foreach ($fid as $key => $val) {
  21. if ($val) {
  22. run_sql($db_link, "DELETE FROM Group_filters WHERE filter_id=".$val);
  23. delete_record($db_link, "Filter_list", "id=$val");
  24. }
  25. }
  26. header("Location: " . $_SERVER["REQUEST_URI"]);
  27. exit;
  28. }
  29. unset($_POST);
  30. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  31. print_filters_submenu($page_url);
  32. ?>
  33. <div id="cont">
  34. <form name="def" action="index.php" method="post">
  35. <table class="data">
  36. <tr align="center">
  37. <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
  38. <td><b>id</b></td>
  39. <td><b><?php echo WEB_cell_forename; ?></b></td>
  40. <td><b><?php echo WEB_cell_type; ?></b></td>
  41. <td><b><?php echo WEB_traffic_proto; ?></b></td>
  42. <td><b><?php echo WEB_traffic_dest_address; ?></b></td>
  43. <td><b><?php echo WEB_traffic_dst_port; ?></b></td>
  44. <td><b><?php echo WEB_traffic_src_port; ?></b></td>
  45. <td><b><?php echo WEB_traffic_action; ?></b></td>
  46. <td><b><?php echo WEB_cell_comment; ?></b></td>
  47. <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
  48. </tr>
  49. <?php
  50. $filters = get_records_sql($db_link,'SELECT * FROM Filter_list ORDER BY name');
  51. foreach ($filters as $row) {
  52. print "<tr align=center>\n";
  53. print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
  54. print "<td class=\"data\" ><input type=hidden name=\"id\" value=".$row['id'].">".$row['id']."</td>\n";
  55. print "<td class=\"data\" align=left><a href=editfilter.php?id=".$row['id'].">" . $row['name'] . "</a></td>\n";
  56. if (empty($row['comment'])) { $row['comment']=''; }
  57. if (empty($row['proto'])) { $row['proto']=''; }
  58. if (empty($row['dst'])) { $row['dst']=''; }
  59. if (empty($row['dstport'])) { $row['dstport']=''; }
  60. if (empty($row['srcport'])) { $row['srcport']=''; }
  61. if ($row['type'] == 0) {
  62. print "<td class=\"data\">IP фильтр</td>\n";
  63. print "<td class=\"data\">".$row['proto']."</td>\n";
  64. print "<td class=\"data\">".$row['dst']."</td>\n";
  65. print "<td class=\"data\">".$row['dstport']."</td>\n";
  66. print "<td class=\"data\">".$row['srcport']."</td>\n";
  67. print "<td class=\"data\">" . get_action($row['action']) . "</td>\n";
  68. print "<td class=\"data\">".$row['comment']."</td>\n";
  69. } else {
  70. print "<td class=\"data\">Name фильтр</td>\n";
  71. print "<td class=\"data\"></td>\n";
  72. print "<td class=\"data\">".$row['dst']."</td>\n";
  73. print "<td class=\"data\"></td>\n";
  74. print "<td class=\"data\"></td>\n";
  75. print "<td class=\"data\">" . get_action($row['action']) . "</td>\n";
  76. print "<td class=\"data\">".$row['comment']."</td>\n";
  77. }
  78. print "<td></td></tr>";
  79. }
  80. ?>
  81. </table>
  82. <div>
  83. <?php echo WEB_cell_name; ?>
  84. <input type=text name=newfilter value="Unknown">
  85. <?php echo Web_filter_type; ?>
  86. <select name="filter_type" disabled=true>
  87. <option value=0 selected>IP фильтр</option>
  88. <option value=1>Name фильтр</option>
  89. </select>
  90. <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
  91. </form>
  92. <?php
  93. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  94. ?>