index.php 700 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. ob_start();
  4. session_start();
  5. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  6. // Check token
  7. verify_csrf($_GET);
  8. // Check user
  9. if ($_SESSION["userContext"] != "admin") {
  10. header("Location: /list/user");
  11. exit();
  12. }
  13. if (!empty($_GET["rule"])) {
  14. $v_rule = quoteshellarg($_GET["rule"]);
  15. $v_direction = quoteshellarg($_GET["direction"]);
  16. exec(HESTIA_CMD . "v-move-firewall-rule " . $v_rule . " " . $v_direction, $output, $return_var);
  17. }
  18. check_return_code($return_var, $output);
  19. unset($output);
  20. $back = getenv("HTTP_REFERER");
  21. if (!empty($back)) {
  22. header("Location: " . $back);
  23. exit();
  24. }
  25. header("Location: /list/firewall/");
  26. exit();