index.php 661 B

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