index.php 806 B

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