index.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".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. }
  16. }
  17. if (isset($_POST["remove"])) {
  18. $fid = $_POST["fid"];
  19. foreach ($fid as $key => $val) {
  20. if ($val) {
  21. delete_record($db_link, "Group_filters", "filter_id=$val");
  22. delete_record($db_link, "Filter_list", "id=$val");
  23. }
  24. }
  25. header("Location: " . $_SERVER["REQUEST_URI"]);
  26. }
  27. unset($_POST);
  28. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  29. print_filters_submenu($page_url);
  30. ?>
  31. <div id="cont">
  32. <form name="def" action="index.php" method="post">
  33. <table class="data">
  34. <tr align="center">
  35. <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
  36. <td><b>id</b></td>
  37. <td><b>Имя</b></td>
  38. <td><b>Тип</b></td>
  39. <td><b>Протокол</b></td>
  40. <td><b>Адрес назначения</b></td>
  41. <td><b>Порт</b></td>
  42. <td><b>Действие</b></td>
  43. </tr>
  44. <?
  45. $filters = get_records($db_link,'Filter_list','TRUE ORDER BY name');
  46. foreach ($filters as $row) {
  47. print "<tr align=center>\n";
  48. print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
  49. print "<td class=\"data\" ><input type=hidden name=\"id\" value=".$row['id'].">".$row['id']."</td>\n";
  50. print "<td class=\"data\" align=left><a href=editfilter.php?id=".$row['id'].">" . $row['name'] . "</a></td>\n";
  51. if ($row['type'] == 0) {
  52. print "<td class=\"data\">IP фильтр</td>\n";
  53. print "<td class=\"data\">".$row['proto']."</td>\n";
  54. print "<td class=\"data\">".$row['dst']."</td>\n";
  55. print "<td class=\"data\">".$row['dstport']."</td>\n";
  56. print "<td class=\"data\">" . get_action($row['action']) . "</td>\n<tr>";
  57. } else {
  58. print "<td class=\"data\">Name фильтр</td>\n";
  59. print "<td class=\"data\"></td>\n";
  60. print "<td class=\"data\">".$row['dst']."</td>\n";
  61. print "<td class=\"data\"></td>\n";
  62. print "<td class=\"data\">" . get_action($row['action']) . "</td>\n<tr>";
  63. }
  64. }
  65. ?>
  66. </table>
  67. <table class="data">
  68. <tr align=left>
  69. <td>Название <input type=text name=newfilter value="Unknown"></td>
  70. <td>Тип фильтра <select name="filter_type" disabled=true>
  71. <option value=0 selected>IP фильтр</option>
  72. <option value=1>Name фильтр</option>
  73. </select>
  74. </td>
  75. <td><input type="submit" name="create" value="Добавить"></td>
  76. <td align="right"><input type="submit" onclick="return confirm('Удалить?')" name="remove" value="Удалить"></td>
  77. </tr>
  78. </table>
  79. </form>
  80. <?
  81. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  82. ?>