control.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. unset($_POST);
  61. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  62. print_control_submenu($page_url);
  63. ?>
  64. <div id="cont">
  65. <br>
  66. <form name="def" action="control.php" method="post">
  67. <table class="data">
  68. <?php
  69. if (is_option($db_link, 37)) {
  70. print "<tr><td align=right>Управление доступом &nbsp<input type=submit name='recheck_ip' value='Обновить'></td></tr>";
  71. }
  72. if (is_option($db_link, 38)) {
  73. print "<tr><td align=right>Конфигурация dhcp &nbsp<input type=submit name='refresh_dhcp' value='Обновить' ></td></tr>";
  74. }
  75. if (is_option($db_link, 39)) {
  76. print "<tr><td align=right>Конфигурация dns &nbsp<input type=submit name='refresh_dns' value='Обновить' ></td></tr>";
  77. }
  78. if (is_option($db_link, 40)) {
  79. print "<tr><td align=right>Reconfigure Nagios &nbsp<input type=submit name='refresh_nagios' value='Обновить'></td></tr>";
  80. }
  81. if (is_option($db_link, 41)) {
  82. print "<tr><td align=right>Сканирование сети &nbsp<input type=submit name='discovery' value='Выполнить'></td></tr>";
  83. }
  84. if (is_option($db_link, 41)) {
  85. print "<tr><td align=right>Активное сканирование &nbsp<input type=submit name='discovery2' value='Выполнить'></td></tr>";
  86. }
  87. if (get_option($db_link, 23)) {
  88. print "<tr><td align=right>Включить запись трафика у всех&nbsp<input type=submit name='save_traf_all' value='Выполнить'></td></tr>";
  89. print "<tr><td align=right>Выключить запись трафика у всех&nbsp<input type=submit name='not_save_traf_all' value='Выполнить'></td></tr>";
  90. }
  91. ?>
  92. <tr>
  93. <td align=right><a href="ipcam.php">Управление портами</a></td>
  94. </tr>
  95. </table>
  96. </form>
  97. <?php
  98. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  99. ?>