index.php 852 B

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