include "../include/common.php"; include "../config.php"; include "../include/session.php"; include "../include/dbconnect.php"; include "../include/account.php"; include "../include/ghost.php"; if (isset($_SESSION['account_id']) && isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) && isset($_SESSION['is_' . $_REQUEST['id'] . '_ghost'])) { $service_id = $_REQUEST['id']; $message = ""; if (isset($_REQUEST['message'])) { $message = $_REQUEST['message']; } if (isset($_POST['action'])) { if ($_POST['action'] == "start") { $result = ghostBotStart($service_id); 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") {
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; } }