Skip to content

Commit

Permalink
RCON api fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rauks authored Feb 27, 2017
1 parent a2d1108 commit cb5e975
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rcon/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
$response['status'] = 'error';
$response['error'] = 'Empty command';
}

if ($rcon->connect()){
$rcon->send_command($_POST['cmd']);
$response['status'] = 'success';
$response['command'] = $_POST['cmd'];
$response['response'] = $rcon->get_response();
}
else{
$response['status'] = 'error';
$response['error'] = 'RCON connection error';
if ($rcon->connect()){
$rcon->send_command($_POST['cmd']);
$response['status'] = 'success';
$response['command'] = $_POST['cmd'];
$response['response'] = $rcon->get_response();
}
else{
$response['status'] = 'error';
$response['error'] = 'RCON connection error';
}
}

echo json_encode($response);
Expand Down

0 comments on commit cb5e975

Please sign in to comment.