index.php 761 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. $ipchain = $_POST['ipchain'];
  14. $action = $_POST['action'];
  15. switch ($action) {
  16. case 'delete': $cmd='v-delete-firewall-ban';
  17. break;
  18. default: header("Location: /list/firewall/banlist/"); exit;
  19. }
  20. foreach ($ipchain as $value) {
  21. list($ip, $chain) = explode(":", $value);
  22. $v_ip = quoteshellarg($ip);
  23. $v_chain = quoteshellarg($chain);
  24. exec(HESTIA_CMD.$cmd." ".$v_ip." ".$v_chain, $output, $return_var);
  25. }
  26. header("Location: /list/firewall/banlist");