index.php 747 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. ob_start();
  4. // Main include
  5. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  6. // Check token
  7. verify_csrf($_POST);
  8. // Check user
  9. if ($_SESSION["userContext"] != "admin") {
  10. header("Location: /list/user");
  11. exit();
  12. }
  13. $ipchain = $_POST["ipchain"];
  14. $action = $_POST["action"];
  15. switch ($action) {
  16. case "delete":
  17. $cmd = "v-delete-firewall-ban";
  18. break;
  19. default:
  20. header("Location: /list/firewall/banlist/");
  21. exit();
  22. }
  23. foreach ($ipchain as $value) {
  24. [$ip, $chain] = explode(":", $value);
  25. $v_ip = quoteshellarg($ip);
  26. $v_chain = quoteshellarg($chain);
  27. exec(HESTIA_CMD . $cmd . " " . $v_ip . " " . $v_chain, $output, $return_var);
  28. }
  29. header("Location: /list/firewall/banlist");