control.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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["recheck_ip"]) and is_option($db_link, 37)) {
  5. $run_cmd = get_option($db_link, 37);
  6. shell_exec("sudo $run_cmd >/dev/null 2>/dev/null &");
  7. LOG_INFO($db_link, "Run command: $run_cmd");
  8. header("Location: " . $_SERVER["REQUEST_URI"]);
  9. }
  10. if (isset($_POST["refresh_dhcp"]) and is_option($db_link, 38)) {
  11. $run_cmd = get_option($db_link, 38);
  12. shell_exec("sudo $run_cmd >/dev/null 2>/dev/null &");
  13. LOG_INFO($db_link, "Run command: $run_cmd");
  14. header("Location: " . $_SERVER["REQUEST_URI"]);
  15. }
  16. if (isset($_POST["refresh_nagios"]) and is_option($db_link, 40)) {
  17. $run_cmd = get_option($db_link, 40);
  18. shell_exec("sudo $run_cmd >/dev/null 2>/dev/null &");
  19. LOG_INFO($db_link, "Run command: $run_cmd");
  20. header("Location: " . $_SERVER["REQUEST_URI"]);
  21. }
  22. if (isset($_POST["refresh_dns"]) and is_option($db_link, 39)) {
  23. $run_cmd = get_option($db_link, 39);
  24. shell_exec("sudo $run_cmd >/dev/null 2>/dev/null &");
  25. LOG_INFO($db_link, "Run command: $run_cmd");
  26. header("Location: " . $_SERVER["REQUEST_URI"]);
  27. }
  28. if (isset($_POST["discovery"]) and is_option($db_link, 41)) {
  29. $run_cmd = get_option($db_link, 41);
  30. shell_exec("sudo $run_cmd >/dev/null 2>/dev/null &");
  31. LOG_DEBUG($db_link, "Run command: $run_cmd");
  32. header("Location: " . $_SERVER["REQUEST_URI"]);
  33. }
  34. if (isset($_POST["discovery2"]) and is_option($db_link, 41)) {
  35. $run_cmd = get_option($db_link, 41);
  36. shell_exec("sudo $run_cmd 1 >/dev/null 2>/dev/null &");
  37. LOG_INFO($db_link, "Run command: $run_cmd 1");
  38. header("Location: " . $_SERVER["REQUEST_URI"]);
  39. }
  40. if (isset($_POST["save_traf_all"]) and get_option($db_link, 23)) {
  41. run_sql($db_link, 'Update User_auth set save_traf=1 where deleted=0');
  42. LOG_INFO($db_link, "Enable save traffic for all!");
  43. header("Location: " . $_SERVER["REQUEST_URI"]);
  44. }
  45. if (isset($_POST["not_save_traf_all"]) and get_option($db_link, 23)) {
  46. run_sql($db_link, 'Update User_auth set save_traf=0 where deleted=0');
  47. LOG_INFO($db_link, "Disable save traffic for all!");
  48. header("Location: " . $_SERVER["REQUEST_URI"]);
  49. }
  50. if (isset($_POST["s_remove"])) {
  51. $s_id = $_POST["s_id"];
  52. while (list ($key, $val) = @each($s_id)) {
  53. if (isset($val)) {
  54. LOG_INFO($db_link, "Remove subnet id: $val");
  55. delete_record($db_link, "subnets", "id=" . $val);
  56. }
  57. }
  58. header("Location: " . $_SERVER["REQUEST_URI"]);
  59. }
  60. if (isset($_POST["clean_cache"])) {
  61. LOG_INFO($db_link, "Clean dns cache");
  62. run_sql($db_link,"DELETE FROM dns_cache");
  63. header("Location: " . $_SERVER["REQUEST_URI"]);
  64. }
  65. unset($_POST);
  66. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  67. print_control_submenu($page_url);
  68. ?>
  69. <div id="cont">
  70. <br>
  71. <form name="def" action="control.php" method="post">
  72. <table class="data">
  73. <?php
  74. if (is_option($db_link, 37)) {
  75. print "<tr><td align=right>Управление доступом &nbsp<input type=submit name='recheck_ip' value='Обновить'></td></tr>";
  76. }
  77. if (is_option($db_link, 38)) {
  78. print "<tr><td align=right>Конфигурация dhcp &nbsp<input type=submit name='refresh_dhcp' value='Обновить' ></td></tr>";
  79. }
  80. if (is_option($db_link, 39)) {
  81. print "<tr><td align=right>Конфигурация dns &nbsp<input type=submit name='refresh_dns' value='Обновить' ></td></tr>";
  82. }
  83. if (is_option($db_link, 40)) {
  84. print "<tr><td align=right>Reconfigure Nagios &nbsp<input type=submit name='refresh_nagios' value='Обновить'></td></tr>";
  85. }
  86. if (is_option($db_link, 41)) {
  87. print "<tr><td align=right>Сканирование сети &nbsp<input type=submit name='discovery' value='Выполнить'></td></tr>";
  88. }
  89. if (is_option($db_link, 41)) {
  90. print "<tr><td align=right>Активное сканирование &nbsp<input type=submit name='discovery2' value='Выполнить'></td></tr>";
  91. }
  92. if (get_option($db_link, 23)) {
  93. print "<tr><td align=right>Включить запись трафика у всех&nbsp<input type=submit name='save_traf_all' value='Выполнить'></td></tr>";
  94. print "<tr><td align=right>Выключить запись трафика у всех&nbsp<input type=submit name='not_save_traf_all' value='Выполнить'></td></tr>";
  95. }
  96. print "<tr><td align=right>Сбросить кэш&nbsp<input type=submit name='clean_cache' value='Выполнить'></td></tr>";
  97. ?>
  98. <tr>
  99. <td align=right><a href="ipcam.php">Управление портами</a></td>
  100. </tr>
  101. </table>
  102. </form>
  103. <?php
  104. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  105. ?>