index.php 752 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // Init
  3. ob_start();
  4. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  5. // Check token
  6. verify_csrf($_GET);
  7. if ($_SESSION['userContext'] === 'admin') {
  8. if (!empty($_GET['srv'])) {
  9. if ($_GET['srv'] == 'iptables') {
  10. exec(HESTIA_CMD."v-stop-firewall", $output, $return_var);
  11. } else {
  12. $v_service = escapeshellarg($_GET['srv']);
  13. exec(HESTIA_CMD."v-stop-service ".$v_service, $output, $return_var);
  14. }
  15. }
  16. if ($return_var != 0) {
  17. $error = implode('<br>', $output);
  18. if (empty($error)) {
  19. $error = _('Stop "%s" failed', $v_service);
  20. }
  21. $_SESSION['error_srv'] = $error;
  22. }
  23. unset($output);
  24. }
  25. header("Location: /list/server/");
  26. exit;