index.php 712 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. ob_start();
  3. // Main include
  4. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  5. // Check token
  6. verify_csrf($_POST);
  7. // Check user
  8. if ($_SESSION['userContext'] != 'admin') {
  9. header("Location: /list/user");
  10. exit;
  11. }
  12. $ipchain = $_POST['ipchain'];
  13. $action = $_POST['action'];
  14. switch ($action) {
  15. case 'delete': $cmd='v-delete-firewall-ban';
  16. break;
  17. default: header("Location: /list/firewall/banlist/"); exit;
  18. }
  19. foreach ($ipchain as $value) {
  20. list($ip, $chain) = explode(":", $value);
  21. $v_ip = escapeshellarg($ip);
  22. $v_chain = escapeshellarg($chain);
  23. exec(HESTIA_CMD.$cmd." ".$v_ip." ".$v_chain, $output, $return_var);
  24. }
  25. header("Location: /list/firewall/banlist");