コード例 #1
0
}
if (!empty($_GET['ba'])) {
    $bansAdmin = $_GET['ba'];
} else {
    $bansAdmin = "";
}
$lan_file = ROOTDIR . '/languages/' . $LANGUAGE . '/lan_banlist.php';
include file_exists($lan_file) ? $lan_file : ROOTDIR . "/languages/English/lan_banlist.php";
$banQueries = new BanQueries();
// Ban delete process
if ($fullPower) {
    // A full power admin executed a ban delete
    if (!empty($_GET['process']) && !empty($_GET['BanId'])) {
        if ($_GET['process'] == "delete") {
            if ($_GET['BanId'] != null || $_GET['BanId'] != "") {
                $deleteBannedUser = $banQueries->getBannedUser($_GET['BanId']);
                unBanUser($deleteBannedUser->getSteamId(), $deleteBannedUser->getIp());
                $banQueries->deleteBan($deleteBannedUser->getSteamId());
            }
        }
    }
}
function unBanUser($steamId, $bannedIP)
{
    // This will send an RCON command to the server
    $serverQueries = new ServerQueries();
    // Get the list of servers
    $servers = $serverQueries->getServers();
    // Cycle through each server
    foreach ($servers as $server) {
        $r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());
コード例 #2
0
$ModifiedBy = $_POST['ModifiedBy'];
$fullPowerLevelEditUser = $_POST['fullPowerLevelEditUser'];
// Make sure the user is an UNBU member, admin, or ban manager
if ($member || $admin || $banManager || $fullPower) {
    $allowedToBan = true;
}
if ($allowedToBan) {
    // Make sure special chars for MySQL are escaped
    $bannedUser = addslashes($bannedUser);
    $bannedUser = str_ireplace(array("\"", "\r\n", "\n", "\r", ";"), "", $bannedUser);
    // Remove ; to prevent kick command inyection like name; quit or ; _restart
    $banQueries = new BanQueries();
    $lengthQueries = new LengthQueries();
    $length = $lengthQueries->getBanLength($lengthId);
    // Banned user information
    $bannedUserO = $banQueries->getBannedUser($banId);
    if ($fullPower || $banManager || $bannedUserO->getBanner() == $_SESSION['name'] && !empty($_SESSION['name']) && ($admin || $member) || $bannedUserO->getBannerSteamId() == $_SESSION['steamId'] && !empty($_SESSION['steamId']) && ($admin || $member)) {
        // We are banning an IP
        if (isset($_POST['banIp'])) {
            $banQueries->addIpBan($_POST['ip']);
            header("Location: index.php?page=updateBan&banId=" . $banId);
        } else {
            if (isset($_POST['updateBan'])) {
                // We are updating ban information
                if ($config->enableSmfIntegration) {
                    $username = $user_info['username'];
                } else {
                    $username = $_SESSION['name'];
                }
                if (!$fullPowerLevelEditUser || $fullPower) {
                    $ModifiedBy = $username;
コード例 #3
0
$id = $_POST['id'];
$active = $_POST['active'];
// Switch the current active state to the other state
// off becomes on, and on becomes off
if ($active == 0) {
    $active = 1;
} else {
    $active = 0;
}
$banQueries = new BanQueries();
// Must be logged in to change the status
if ($member || $admin || $banManager || $fullPower) {
    $banQueries->updateBanActiveStatus($active, $id);
    if ($active == 0) {
        //$bannedUser = new BannedUser();
        $bannedUser = $banQueries->getBannedUser($id);
        unBanUser($bannedUser->getSteamId(), $bannedUser->getIp());
    }
}
function unBanUser($steamId, $bannedIP)
{
    // This will send an RCON command to the server
    $serverQueries = new ServerQueries();
    // Get the list of servers
    $servers = $serverQueries->getServers();
    // Cycle through each server
    foreach ($servers as $server) {
        $r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());
        if ($r->isValid()) {
            $r->Auth();
            $r->sendRconCommand("removeid " . $steamId);