index.php 718 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. // Init
  4. ob_start();
  5. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  6. // Check token
  7. verify_csrf($_GET);
  8. if ($_SESSION["userContext"] === "admin") {
  9. if (!empty($_GET["srv"])) {
  10. if ($_GET["srv"] == "iptables") {
  11. exec(HESTIA_CMD . "v-stop-firewall", $output, $return_var);
  12. } else {
  13. $v_service = quoteshellarg($_GET["srv"]);
  14. exec(HESTIA_CMD . "v-stop-service " . $v_service, $output, $return_var);
  15. }
  16. }
  17. if ($return_var != 0) {
  18. $error = implode("<br>", $output);
  19. if (empty($error)) {
  20. $error = _('Stop "%s" failed', $v_service);
  21. }
  22. $_SESSION["error_srv"] = $error;
  23. }
  24. unset($output);
  25. }
  26. header("Location: /list/server/");
  27. exit();