index.php 880 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. ob_start();
  4. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  5. // Check token
  6. verify_csrf($_POST);
  7. if (empty($_POST["ip"])) {
  8. header("Location: /list/ip");
  9. exit();
  10. }
  11. if (empty($_POST["action"])) {
  12. header("Location: /list/ip");
  13. exit();
  14. }
  15. $ip = $_POST["ip"];
  16. $action = $_POST["action"];
  17. if ($_SESSION["userContext"] === "admin") {
  18. switch ($action) {
  19. case "reread IP":
  20. exec(HESTIA_CMD . "v-update-sys-ip", $output, $return_var);
  21. header("Location: /list/ip/");
  22. exit();
  23. break;
  24. case "delete":
  25. $cmd = "v-delete-sys-ip";
  26. break;
  27. default:
  28. header("Location: /list/ip/");
  29. exit();
  30. }
  31. } else {
  32. header("Location: /list/ip/");
  33. exit();
  34. }
  35. foreach ($ip as $value) {
  36. $value = quoteshellarg($value);
  37. exec(HESTIA_CMD . $cmd . " " . $value, $output, $return_var);
  38. }
  39. header("Location: /list/ip/");