index.php 835 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. if (empty($_POST["setname"])) {
  14. header("Location: /list/firewall/ipset/");
  15. exit();
  16. }
  17. if (empty($_POST["action"])) {
  18. header("Location: /list/firewall/ipset/");
  19. exit();
  20. }
  21. $setname = $_POST["setname"];
  22. $action = $_POST["action"];
  23. switch ($action) {
  24. case "delete":
  25. $cmd = "v-delete-firewall-ipset";
  26. break;
  27. default:
  28. header("Location: /list/firewall/ipset/");
  29. exit();
  30. }
  31. foreach ($setname as $value) {
  32. $v_name = quoteshellarg($value);
  33. exec(HESTIA_CMD . $cmd . " " . $v_name, $output, $return_var);
  34. }
  35. header("Location: /list/firewall/ipset/");