Ejemplo n.º 1
0
function rconstatus($ip, $port, $rcon_pass)
{
    $result = rcon($ip, $port, $rcon_pass, "status");
    $result = explode("\n", $result);
    print "<table class=\"table table-hover table-bordered\">\n";
    print "<thead>";
    printheadrow(array("ID", "Current score", "Ping", "Name", "IP", "Rate"));
    print "</thead>\n";
    array_shift($result);
    // 1st line : map q3wcp9
    array_shift($result);
    // 2nd line : col headers
    array_shift($result);
    // 3rd line : -- ------ ----
    array_pop($result);
    array_pop($result);
    // two empty lines at the end
    foreach ($result as $line) {
        $player = $line;
        preg_match_all("/^\\s*(\\d+)\\s*(\\d+)\\s*(\\d+)(.*?)(\\d*)\\s*(\\S*)\\s*(\\d*)\\s*(\\d*)\\s*\$/", $player, $out);
        $num = $out[1][0];
        $score = $out[2][0];
        $ping = $out[3][0];
        $name = trim($out[4][0]);
        //$lastmsg = $out[5][0];
        $address = $out[6][0];
        if ($address != 'bot') {
            $addressip = preg_replace("/:.*\$/", "", $address);
            $address = "{$address}";
        }
        //$qport = $out[7][0];
        $rate = $out[8][0];
        printrow(array($num, $score, $ping, $name, $address, $rate), "");
    }
    print "\n</table>\n";
}
Ejemplo n.º 2
0
    while ($i <= $game_num_srvs) {
        if ($config['games'][$game]['servers'][$i]['pb_active'] == '1') {
            // get the rcon information from the massive config array
            $rcon_pass = $config['game']['servers'][$i]['rcon_pass'];
            $rcon_ip = $config['game']['servers'][$i]['rcon_ip'];
            $rcon_port = $config['game']['servers'][$i]['rcon_port'];
            $c_ip = trim($c_ip);
            // PB_SV_BanGuid [guid] [player_name] [IP_Address] [reason]
            $command = "pb_sv_banguid " . $pbid . " " . $c_name . " " . $c_ip . " " . $reason;
            rcon($rcon_ip, $rcon_port, $rcon_pass, $command);
            // send the ban command
            sleep(1);
            // sleep for 1 sec in ordere to the give server some time
            $command_upd = "pb_sv_updbanfile";
            // we need to update the ban files
            rcon($rcon_ip, $rcon_port, $rcon_pass, $command_upd);
            // send the ban file update command
        }
        $i++;
    }
}
// end if a $is_pb_ban == true
if ($result) {
    // set comment for the ban, and log it
    if ($type == 'Ban') {
        $comment = 'permanent ban, for "' . $reason . '"';
    } else {
        $dur_name = array('m' => 'minute', 'h' => 'hour', 'd' => 'day', 'w' => 'week', 'mn' => 'month', 'y' => 'year');
        $comment = $duration_form . ' ' . $dur_name[$time] . ' temp ban, for \\"' . $reason . '\\"';
    }
    $result = $dbl->addEchLog('Ban', $comment, $client_id, $mem->id, $game);
Ejemplo n.º 3
0
             mysql_query("INSERT INTO `log_tool`(`action`, `user`, `timestamp`) VALUES ('START SERVER','{$_SESSION['login']}', NOW())");
             sleep(6);
             break;
         case 1:
             exec('taskkill /IM "' . $exeserver . '"');
             mysql_query("INSERT INTO `log_tool` (`action`, `user`, `timestamp`) VALUES ('STOP SERVER', '{$_SESSION['login']}', NOW())");
             sleep(3);
             break;
         case 2:
             exec('taskkill /IM "' . $exeserver . '" /F 2>&1', $output);
             mysql_query("INSERT INTO `log_tool` (`action`, `user`, `timestamp`) VALUES ('KILLED SERVER', '{$_SESSION['login']}', NOW())");
             sleep(3);
             $outmessage = implode('&nbsp;', $output);
             break;
         case 3:
             rcon($serverip, $serverport, $rconpassword, "#restart");
             mysql_query("INSERT INTO `log_tool` (`action`, `user`, `timestamp`) VALUES ('RESTART SERVER', '{$_SESSION['login']}', NOW())");
             sleep(1);
             break;
         default:
             sleep(1);
     }
     echo '<script type="text/javascript">$.unblockUI</script>';
 }
 $tasklist = exec('tasklist /FI "IMAGENAME eq ' . $exeserver . '" /FO CSV');
 $tasklist = explode(",", strtolower($tasklist));
 $tasklist = str_replace('"', "", $tasklist[0]);
 if ($tasklist == strtolower($exeserver)) {
     $serverrunning = true;
 } else {
     $serverrunning = false;
Ejemplo n.º 4
0
				
			$answer = rcon($serverip,$serverport,$rconpassword,$cmd);
			?>
			<script type="text/javascript">
				window.location = 'index.php?view=table&show=0';
			</script>
			<?
		}
		if (isset($_POST["say"])){
			$id = "-1";
			if (isset($_GET["id"])){
				$id = $_GET["id"];
			}
			$cmd = "Say ".$id." ".$_POST["say"];
				
			$answer = rcon($serverip,$serverport,$rconpassword,$cmd);
			?>
			<script type="text/javascript">
				window.location = 'index.php';
			</script>
			<?
		}
	//}
	?>
	<script type="text/javascript">
		window.location = 'index.php';
	</script>
	<?

	
	
Ejemplo n.º 5
0
$requiredlevel = 3;
require_once 'Connections/b3connect.php';
require_once 'login/inc_authorize.php';
require_once 'admin/rcon.php';
if ($chatlogger_plugin_activated != 1) {
    header("Location: {$path}/clients.php?game={$game}");
    exit;
}
$currentPage = $_SERVER["PHP_SELF"];
$talkback = "";
if (isset($_POST['talkback'])) {
    $talkback = $_POST['talkback'];
    if ($talkback != "") {
        $command = "say ^4[B3](^3" . $_SESSION['xlradmin'] . "^4): ^3" . $talkback;
        //echo "command: " . $command;
        rcon($command);
    }
}
if (isset($_GET['maxRows_rs_chats'])) {
    $maxRows_rs_chats = $_GET['maxRows_rs_chats'];
} else {
    $maxRows_rs_chats = 50;
}
$pageNum_rs_chats = 0;
if (isset($_GET['pageNum_rs_chats'])) {
    $pageNum_rs_chats = $_GET['pageNum_rs_chats'];
}
$startRow_rs_chats = $pageNum_rs_chats * $maxRows_rs_chats;
$xlorderby_rs_chats = "id";
if (isset($_GET['orderby'])) {
    $xlorderby_rs_chats = get_magic_quotes_gpc() ? $_GET['orderby'] : addslashes($_GET['orderby']);
Ejemplo n.º 6
0
<?php

require 'steamauth/steamauth.php';
if (!isset($_SESSION['authed'])) {
    header("Location: steamauth/logout.php?noadmin");
    die;
}
require 'steamauth/userInfo.php';
require 'config.php';
require 'rcon.php';
$time = $_POST['time'];
if ($_POST['multiplier'] == 0) {
    $multiplier = "Permanent";
    $time = "";
} elseif ($_POST['multiplier'] == 1) {
    $multiplier = "Minutes";
} elseif ($_POST['multiplier'] == 60) {
    $multiplier = "Hours";
} elseif ($_POST['multiplier'] == 1440) {
    $multiplier = "Days";
} else {
    $multiplier = "UNDEFINED";
}
if (empty($_POST['reason'])) {
    $reason = "No reason specified";
} else {
    $reason = $_POST['reason'];
}
rcon($server_ip, $server_port, $rcon_password, "addBan " . $_POST['guid'] . " " . $_POST['time'] * $_POST['multiplier'] . " Banned {$time} {$multiplier} by " . $steamprofile['personaname'] . ". Reason: {$reason}");
echo "Banned " . $_POST['guid'] . " {$time} {$multiplier}. This can only be undone by editing the bans.txt on your server.";
Ejemplo n.º 7
0
    die;
}
if (!isset($_POST['cmd']) and !isset($_POST['token'])) {
    die("Don't mess with this, buddy.");
}
require 'SourceQuery/SourceQuery.class.php';
$squery = new SourceQuery();
require 'config.php';
$squery->connect($server_ip, $server_port, 3, SourceQuery::SOURCE);
function rcon()
{
    // NOPE
}
if ($_POST["cmd"] == "kickall") {
    rcon("kick *");
    echo "All players kicked.";
} elseif ($_POST["cmd"] == "lock") {
    rcon("lock");
    echo "Server has been locked.";
} elseif ($_POST["cmd"] == "unlock") {
    rcon("unlock");
    echo "Server has been unlocked.";
} elseif ($_POST["cmd"] == "restart") {
    rcon("restart");
    echo "Server is restarting...";
} elseif ($_POST["cmd"] == "quit") {
    rcon("shutdown");
    echo "Server is shutting down...";
} else {
    echo "Unknown command";
}
Ejemplo n.º 8
0
<?php

require "../classes/rcon.php";
require "../gfunctions.php";
if (isset($_GET['sid'])) {
    $sid = clean($_GET['sid'], "int");
    $db_connection = masterConnect();
    $sql = "SELECT `sq_ip`,`sq_port`,`rcon_pass` FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
    $result_of_query = $db_connection->query($sql);
    if ($result_of_query->num_rows == 1) {
        $server = $result_of_query->fetch_object();
        try {
            $answer = rcon(decrypt($server->sq_ip), decrypt($server->sq_port), decrypt($server->rcon_pass), "Players");
            $k = strrpos($answer, "---");
            $l = strrpos($answer, "(");
            $out = substr($answer, $k + 4, $l - $k - 5);
            $array = preg_split('/$\\R?^/m', $out);
            $playersr = array();
            if ($array[0] == '(0 players in total') {
                $array = array();
            }
            for ($i = 0; $i < count($array); $i++) {
                $playersr[$i] = array_values(array_diff(explode(' ', $array[$i]), array(null)));
            }
            echo json_encode($playersr);
        } catch (Exception $e) {
            echo $e->getMessage();
            var_dump($e);
        }
    }
}
Ejemplo n.º 9
0
<?php

require_once 'queries.php';
//ini_set( "display_errors", 0);
//error_reporting (E_ALL ^ E_NOTICE);		<th class="table-header-repeat line-left" width="15%"><a href="">IP Address</a></th>
//<th class="table-header-repeat line-left" width="5%"><a href="">Ping</a></th>
$cmd = "Players";
$answer = rcon($serverip_internal, $serverport, $rconpassword, $cmd);
$tableheader = header_player(0);
if ($answer != "" && !strpos($answer, "0 players")) {
    $k = strrpos($answer, "---");
    $l = strrpos($answer, "(");
    $out = substr($answer, $k + 4, $l - $k - 5);
    $array = preg_split('/$\\R?^/m', $out);
    //echo $answer."<br /><br />";
    $players = array();
    for ($j = 0; $j < count($array); $j++) {
        $players[] = "";
    }
    for ($i = 0; $i < count($array); $i++) {
        $m = 0;
        for ($j = 0; $j < 5; $j++) {
            $players[$i][] = "";
        }
        $pout = preg_replace('/\\s+/', ' ', $array[$i]);
        for ($j = 0; $j < strlen($pout); $j++) {
            $char = substr($pout, $j, 1);
            if ($m < 4) {
                if ($char != " ") {
                    $players[$i][$m] .= $char;
                } else {
Ejemplo n.º 10
0
function talkback()
{
    $game = getPostOrGet('game');
    if (is_null($game)) {
        header("HTTP/1.1 400 Bad Request");
        echo "game undefined";
        exit;
    }
    global $config;
    //echo print_r($config["servers"][$game], true); exit;
    loadGameConfig($config["servers"][$game]);
    global $rcon_ip, $rcon_port, $rcon_pass;
    //echo "$rcon_ip, $rcon_port, $rcon_pass"; exit;
    $talkback = getPostOrGet('talkback');
    if (is_null($talkback)) {
        header("HTTP/1.1 400 Bad Request");
        echo "talkback undefined";
        exit;
    }
    if ("" . $talkback != "") {
        require_once 'admin/rcon.php';
        $command = "say ^4[B3](^3" . $_SESSION['xlradmin'] . "^4): ^3" . $talkback;
        //echo "command: " . $command;
        header('Content-type: text/plain');
        echo rcon($command) . "\n";
    } else {
        header("HTTP/1.1 400 Bad Request");
        echo "talkback message is empty";
        exit;
    }
}
Ejemplo n.º 11
0
<?php

include 'rcon.php';
include 'config.php';
echo rcon($server_ip, $server_port + 1, $rcon_password, "Players");
Ejemplo n.º 12
0
<?php

require 'steamauth/steamauth.php';
if (!isset($_SESSION['authed'])) {
    header("Location: steamauth/logout.php?noadmin");
    die;
}
require 'steamauth/userInfo.php';
require 'config.php';
if (!isset($_POST['cmd'])) {
    die("No command supplied.");
}
require 'rcon.php';
$resp = rcon($server_ip, $server_port, $rcon_password, $_POST['cmd']);
echo $resp;
Ejemplo n.º 13
0
 public function talkback($msg, $server_id, $last_id)
 {
     global $mem;
     global $config;
     // get the config servers data
     $talkback = cleanvar($msg);
     $srv_id = cleanvar($server_id);
     if ($mem->reqLevel('chats_talk_back')) {
         if (!empty($talkback)) {
             // get the servers rcon password
             $rcon_pass = $config['game']['servers'][$srv_id]['rcon_pass'];
             $rcon_ip = $config['game']['servers'][$srv_id]['rcon_ip'];
             $rcon_port = $config['game']['servers'][$srv_id]['rcon_port'];
             $command = "say ^7(^3" . $mem->name . "^7): ^2" . $talkback;
             $return = rcon($rcon_ip, $rcon_port, $rcon_pass, $command);
         } else {
             sendBack('You left the message box empty, please fill in the box to send a message to the server');
         }
     } else {
         sendBack('You do not have the correct privilages to talkback to the server');
     }
     $time = time();
     $data[] = array('id' => $last_id, 'msg_time' => $time, 'msg_type' => 'TALKBACK', 'client_id' => 0, 'client_name' => $mem->name, 'msg' => $msg);
     return $this->buildLines($data, 'tb');
 }
Ejemplo n.º 14
0
<?php

require "../classes/rcon.php";
require "../gfunctions.php";
session_name('CyberWorks');
session_set_cookie_params(1209600);
session_start();
if (isset($_POST['sid']) && isset($_POST['command']) && isset($_SESSION['user_level'])) {
    if ($_SESSION['user_level'] > 3) {
        $db_connection = masterConnect();
        $sid = clean($_POST['sid'], "int");
        $rid = clean($_POST['id'], "int");
        $cmd = clean($_POST['command'], "string");
        $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
        $result_of_query = $db_connection->query($sql);
        if ($result_of_query->num_rows == 1) {
            $server = $result_of_query->fetch_object();
            try {
                $answer = rcon(decrypt($server->sq_ip), decrypt($server->sq_port), decrypt($server->rcon_pass), $cmd);
            } catch (Exception $e) {
                echo $e->getMessage();
            }
        }
    }
}
Ejemplo n.º 15
0
<?php

require 'steamauth/steamauth.php';
if (!isset($_SESSION['authed'])) {
    header("Location: steamauth/logout.php?noadmin");
    die;
}
require 'steamauth/userInfo.php';
require 'config.php';
require 'rcon.php';
if ($_POST['token'] != $_SESSION['steamid']) {
    die("BLOCKED kickall-request!<br>If you just clicked a link, make sure you don't click it again.<br><a href='.'>Dashboard</a>");
}
if (empty($_POST['reason'])) {
    $reason = "No reason specified";
} else {
    $reason = $_POST['reason'];
}
rcon($server_ip, $server_port, $rcon_password, "say -1 All players will be kicked by admin " . $steamprofile['personaname'] . ". Reason: {$reason}");
rcon($server_ip, $server_port, $rcon_password, "kick -1");