if (substr($response, 1) != "") { $user_msg = '_ADDBANSUCCESSKICK'; log_to_db("Add ban online", "nick: " . $pl_name . " <" . $pl_steamid . "><" . $pl_ip . "> banned for " . $pl_ban_length . " minutes"); } //$server_msg=substr($response,1); //for debug, shows the response from server $server->Disconnect(); } } } } //kick a player if (isset($_POST["kick"]) && $servers_array[$sid]["address"] != "") { $server_address = explode(":", trim($servers_array[$sid]["address"])); $server = new Rcon(); if ($server->Connect($server_address[0], $server_address[1], $servers_array[$sid]["rcon"])) { $response = $server->RconCommand("kick #" . $pl_uid . " " . $pl_reason); if (substr($response, 1) != "") { $user_msg = "_PLAYERKICKED"; log_to_db("Kick online", "nick: " . $pl_name . " <" . $pl_steamid . "><" . $pl_ip . "> kicked"); } $server_msg = $servers_array[$sid]["address"] . "<br>" . substr($response, 1); //for debug, shows the response from server $server->Disconnect(); } } if ($servers_array[$sid]["mod"]) { //get player list sent by plugin $server_address = explode(":", trim($servers_array[$sid]["address"])); $server = new Rcon(); if ($server->Connect($server_address[0], $server_address[1], $servers_array[$sid]["rcon"])) { $response = $server->ServerPlayers();
$sid = "0"; } $server_id = $servers_list[$sid]; //fetch server_information $resource2 = mysql_query("SELECT * FROM {$config->servers} WHERE id = '" . $server_id . "'") or die(mysql_error()); $result2 = mysql_fetch_object($resource2); if (mysql_num_rows($resource2)) { $split_address = explode(":", $result2->address); $eye_pee = $split_address['0']; $poort = $split_address['1']; $server = new Rcon(); $server->Connect($eye_pee, $poort, $result2->rcon); $infos = $server->Info(); $info = $server->ServerInfo(); //Action $response = $server->RconCommand("amx_timeleft"); $response1 = $server->RconCommand("mp_timelimit"); $response2 = $server->RconCommand("sv_visiblemaxplayers"); //get addons version $response_amxmodx = $server->RconCommand("amxmodx_version"); $response_amxbans = $server->RconCommand("amxbans_version"); $response_ptb = $server->RconCommand("amx_ptb_version"); $response_atac = $server->RconCommand("atac_version"); $response_hlr = $server->RconCommand("hltv_report"); $response_sank = $server->RconCommand("sanksounds_version"); $response_steambans = $server->RconCommand("sbsrv_version"); $response_metamod = $server->RconCommand("metamod_version"); $add_amxx = explode("\"", $response_amxmodx); $add_amxbans = explode("\"", $response_amxbans); $add_ptb = explode("\"", $response_ptb); $add_atac = explode("\"", $response_atac);
$response = $gspy->serv_rcon_response; } else { //echo 'Command has been sent but no response has been receveid (does not indicate an error)'; $empty_result = "Command has been sent but no response has been received (does not indicate an error)"; } } } } else { if ($config->rcon_class == "two") { $split_address = explode(":", $result2->address); $eye_pee = $split_address['0']; $poort = $split_address['1']; $server = new Rcon(); $server->Connect($eye_pee, $poort, $result2->rcon); //Action $response = $server->RconCommand("amx_list"); //close connection $server->Disconnect(); } } $lists = explode("#WM#", $response); if (ereg("ogeoip", $lists['0'])) { $geoip = "off"; } else { $geoip = "on"; } $lists = array_slice($lists, 1); $player_array = array(); foreach ($lists as $list) { $list_2 = explode("#WMW#", $list); if (in_array($list_2['1'], $admin_steamids_array) || in_array($list_2['2'], $admin_usernames_array) || in_array($list_2['0'], $admin_usernames_array)) {
function rcon_send($command, $sid, $max_response_pages = 0) { //get server info global $config; $resource = mysql_query("SELECT address,rcon FROM " . $config->db_prefix . "_serverinfo WHERE id=" . $sid) or die(mysql_error()); $result = mysql_fetch_object($resource); if ($result) { $server_address = explode(":", trim($result->address)); $server_rcon = $result->rcon; $server = new Rcon(); if ($server->Connect($server_address[0], $server_address[1], $server_rcon)) { $response = $server->RconCommand($command, $max_response_pages); $server->Disconnect(); if ($response != "") { return trim($response); } else { return false; } } } }