if ($result === true) { $message = "GHost instance started successfully."; } else { $message = $result; } } else { if ($_POST['action'] == "restart") { $result = ghostBotRestart($service_id); if ($result === true) { $message = "GHost instance restarted successfully."; } else { $message = $result; } } else { if ($_POST['action'] == "stop") { $result = ghostBotStop($service_id); if ($result === true) { $message = "GHost instance stopped successfully."; } else { $message = $result; } } } } if (!isset($_SESSION['noredirect'])) { header("Location: index.php?id=" . $service_id . "&message=" . urlencode($message)); } } $status = ghostGetStatus($service_id); $botStatus = getServiceParam($service_id, "pid") != 0 ? "Online" : "Offline"; get_page("status", "ghost", array('service_id' => $service_id, 'status' => $status, 'message' => $message, 'botStatus' => $botStatus));
function ghostBotRestart($service_id) { if (!ghostBotCanStart($service_id)) { return "Error: please wait ten minutes between starting or restarting the bot."; } $result = ghostBotStop($service_id, true); if ($result === true) { sleep(1); return ghostBotStart($service_id); } else { return $result; } }