index.php 760 B

123456789101112131415161718192021222324252627282930313233343536
  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. $setname = $_POST['setname'];
  19. $action = $_POST['action'];
  20. switch ($action) {
  21. case 'delete': $cmd='v-delete-firewall-ipset';
  22. break;
  23. default: header("Location: /list/firewall/ipset/"); exit;
  24. }
  25. foreach ($setname as $value) {
  26. $v_name = escapeshellarg($value);
  27. exec (HESTIA_CMD.$cmd." ".$v_name, $output, $return_var);
  28. }
  29. header("Location: /list/firewall/ipset/");