index.php 878 B

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