Username:    Password:        Click Here To Signup     Forgotten Password
Main Menu
Online
Members: 0

Guests: 39

200.255.x.x forum
216.244.x.x forum
36.248.x.x forum
40.77.x.x dilbertplus
46.229.x.x dilbertplus
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x dilbertplus
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x user
46.229.x.x forum
46.229.x.x forum
46.229.x.x dilbertplus
46.4.x.x dilbertplus
54.235.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x guestbook
54.36.x.x forum
54.36.x.x forum
54.36.x.x dilbertplus
54.36.x.x lgsl
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
54.36.x.x forum
66.249.x.x forum
66.249.x.x forum

Last Seen

4Rsercom Thu 21:49
Apophis01 Fri 10:15
Bommel Wed 09:39
frob Sat 21:14
ODDBALL118 Fri 17:07

Newest Members

Forums
[IT WORKS] RCON field for LGSL admin page ;)
qwas
Wed Feb 13 2013, 12:39PM

Posts: 46
Joined: Sat Sep 08 2012, 05:20PM
Registered Member #7384
ENG: This modification allows you to write RCON password to the database directly from the LGSL admin page and use it in the future.
RUS: Эта модификация позволяет записывать RCON-пароль в базу данных LGSL прямо из админки, и использовать его в дальнейшем.

STEP 1.
1. Backup file lgsl_admin.php
2. Open file lgsl_admin.php in Notepad++

3. Find the string:
$_POST['form_s_port'][$form_key],

Insert after:
$_POST['form_rcon_pwd'][$form_key],

4. Find the string:
$s_port = mysql_real_escape_string(intval(trim($_POST['form_s_port'][$form_key])));

Insert after:
$rcon_pwd = mysql_real_escape_string(trim($_POST['form_rcon_pwd'][$form_key]));

5. Find the string:
$mysql_query  = "INSERT INTO `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` (`type`,`ip`,`c_port`,`q_port`,`s_port`,`zone`,`disabled`,`comment`,`status`,`cache`,`cache_time`) VALUES ('{$type}','{$ip}','{$c_port}','{$q_port}','{$s_port}','{$zone}','{$disabled}','{$comment}','{$status}','{$cache}','{$cache_time}')"; 

Change it to:
 $mysql_query  = "INSERT INTO `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` (`type`,`ip`,`c_port`,`q_port`,`s_port`,`rcon_pwd`,`zone`,`disabled`,`comment`,`status`,`cache`,`cache_time`) VALUES ('{$type}','{$ip}','{$c_port}','{$q_port}','{$s_port}','{$rcon_pwd}','{$zone}','{$disabled}','{$comment}','{$status}','{$cache}','{$cache_time}')";  

6. Find the string:
<b>TYPE : IP : C PORT : Q PORT : S PORT : ZONES : DISABLED : COMMENT</b>

Change it to:
 <b>TYPE : IP : C PORT : Q PORT : S PORT : RCON PWD : ZONES : DISABLED : COMMENT</b>

7. Find the string:
lgsl_string_html(str_pad($mysql_row['s_port'],   7,  " ")).":".

Insert after:
$mysql_row['rcon_pwd'].":".

8. Find the string:
<td style='text-align:center; white-space:nowrap'>[ Software Port ] </td>

Insert after:
<td style='text-align:center; white-space:nowrap'>[ Rcon Password ]  </td>

9. Find the string:
<td style='text-align:center'><input type='text' name='form_s_port[{$id}]' value='".lgsl_string_html($mysql_row['s_port'])."' size='5'  maxlength='5'   /></td>

Insert after:
<td style='text-align:center'><input type='text' name='form_rcon_pwd[{$id}]' value='".lgsl_string_html($mysql_row['rcon_pwd'])."' size='15'  maxlength='32'   /></td>

10. Find next (the same string):
 <td style='text-align:center'><input type='text' name='form_s_port[{$id}]' value='".lgsl_string_html($mysql_row['s_port'])."' size='5'  maxlength='5'   /></td>

Insert after:
<td style='text-align:center'><input type='text' name='form_rcon_pwd[{$id}]' value='".lgsl_string_html($mysql_row['rcon_pwd'])."' size='15'  maxlength='32'   /></td>

11. Save changes in lgsl_admin.php

STEP 2.
1. Backup file lgsl_class.php
2. Open file lgsl_class.php in Notepad++

3. Find the string:
function lgsl_query_cached($type, $ip, $c_port, $q_port, $s_port, $request, $id = NULL)
  {
    global $lgsl_config

Change the string:
 global $lgsl_config

To:
global $lgsl_config, $rcon_pwd;

4. Find the string:
$cache['b']['s_port']  = $s_port;

Insert after:
$cache['o']['rcon_pwd'] = $rcon_pwd = $mysql_row['rcon_pwd'];


5. Save changes in lgsl_class.php

STEP 3.
1. Go to your phpmyadmin page and login as priveleged user.
2. Go to database which contains lgsl table.

3. Add column to this table with query:
 ALTER TABLE `lgsl` ADD `rcon_pwd`  varchar( 32 ) NOT NULL default '' AFTER `s_port`;

# ----------------------------------------------------------------------------------------------------------------------------
Now, if we need the rcon password to query the server, we can simply insert it in ones field in admin page and press "Save- reset cache" button.
And we must start Query for games with rcon password(in the lgsl_protocol.php) like this:

global $rcon_pwd;
if (empty($rcon_pwd)) { return TRUE; }
fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFrcon {$rcon_pwd} status\x00"); // for example only!

#-----------------------------------------------------------------------------------------------------------------------------
Proof:


p.s Thanks Wussie for good idea with "comment" field.

http://bigshooter.ru
Website
qwas
Sat Apr 20 2013, 04:31AM

Posts: 46
Joined: Sat Sep 08 2012, 05:20PM
Registered Member #7384
ENG: We shall try to apply RCON query (see first post).
For example, to display the GUID and IP ModernWarfare2 players (fourdeltaone edition), we have to use RCON-password.
Here is the solution:

RUS: Попробуем применить RCON (см. первый пост) на практике.
Например, чтобы вывести GUID и IP игроков из ModernWarfare2 (от fourdeltaone) нам нужно использовать RCON-пароль.
Вот работающее решение:
//------------------------------------------------------------------------------------------------------------+
    //------------------------------------------------------------------------------------------------------------+

    function lgsl_query_02(&$server, &$lgsl_need, &$lgsl_fp)
    {
        global $rcon_pwd;

        //---------------------------------------------------------+

        if ($server['b']['type'] == "quake2")
        {
            fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFstatus");
        } elseif ($server['b']['type'] == "warsowold")
        {
            fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetinfo");
        } elseif (strpos($server['b']['type'], "moh") !== false)
        {
            fwrite($lgsl_fp, "\xFF\xFF\xFF\xFF\x02getstatus");
        } // mohaa_ mohaab_ mohaas_ mohpa_
        else
        {
            if (!empty($rcon_pwd))
            {
                fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFrcon {$rcon_pwd} status\x00");
                $buffer2 = fread($lgsl_fp, 4096);
                $part2 = preg_replace("/.*(?:\n)/", "", $buffer2, 4);
                $part2 = explode("\n", $part2);
                $part2 = array_diff($part2, array(null));
                //print_r($buffer2); //for debug only
            }
            fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetstatus");
        }

        $buffer = fread($lgsl_fp, 4096);

        if (!$buffer)
        {
            return false;
        }

        //---------------------------------------------------------+

        $part = explode("\n", $buffer); // SPLIT INTO PARTS: HEADER/SETTINGS/PLAYERS/FOOTER
        array_pop($part); // REMOVE FOOTER WHICH IS EITHER NULL OR "\challenge\"
        $item = explode("\\", $part[1]); // SPLIT PART INTO ITEMS

        foreach ($item as $item_key => $data_key)
        {
            if (!($item_key % 2))
            {
                continue;
            } // SKIP EVEN KEYS

            $data_key = strtolower(lgsl_parse_color($data_key, "1"));
            $server['e'][$data_key] = lgsl_parse_color($item[$item_key + 1], "1");
        }

        //---------------------------------------------------------+

        if (!empty($server['e']['hostname']))
        {
            $server['s']['name'] = $server['e']['hostname'];
        }
        if (!empty($server['e']['sv_hostname']))
        {
            $server['s']['name'] = $server['e']['sv_hostname'];
        }

        if (isset($server['e']['gamename']))
        {
            $server['s']['game'] = $server['e']['gamename'];
        }
        if (isset($server['e']['mapname']))
        {
            $server['s']['map'] = $server['e']['mapname'];
        }

        $server['s']['players'] = empty($part['2']) ? 0 : count($part) - 2;

        if (isset($server['e']['maxclients']))
        {
            $server['s']['playersmax'] = $server['e']['maxclients'];
        } // QUAKE 2
        if (isset($server['e']['sv_maxclients']))
        {
            $server['s']['playersmax'] = $server['e']['sv_maxclients'];
        }

        if (isset($server['e']['pswrd']))
        {
            $server['s']['password'] = $server['e']['pswrd'];
        } // CALL OF DUTY
        if (isset($server['e']['needpass']))
        {
            $server['s']['password'] = $server['e']['needpass'];
        } // QUAKE 2
        if (isset($server['e']['g_needpass']))
        {
            $server['s']['password'] = $server['e']['g_needpass'];
        }

        array_shift($part); // REMOVE HEADER
        array_shift($part); // REMOVE SETTING

        //---------------------------------------------------------+

        if ($server['b']['type'] == "nexuiz")
            // (SCORE) (PING) (TEAM IF TEAM GAME) "(NAME)"
        {
            $pattern = "/(.*) (.*) (.*)\"(.*)\"/U";
            $fields = array(
                1 => "score",
                2 => "ping",
                3 => "team",
                4 => "name");
        } elseif ($server['b']['type'] == "warsow") // (SCORE) (PING) "(NAME)" (TEAM)
        {
            $pattern = "/(.*) (.*) \"(.*)\" (.*)/";
            $fields = array(
                1 => "score",
                2 => "ping",
                3 => "name",
                4 => "team");
        } elseif ($server['b']['type'] == "sof2") // (SCORE) (PING) (DEATHS) "(NAME)"
        {
            $pattern = "/(.*) (.*) (.*) \"(.*)\"/";
            $fields = array(
                1 => "score",
                2 => "ping",
                3 => "deaths",
                4 => "name");
        } elseif (strpos($server['b']['type'], "mohpa") !== false)
        // (?) (SCORE) (?) (TIME) (?) "(RANK?)" "(NAME)"
        {
            $pattern = "/(.*) (.*) (.*) (.*) (.*) \"(.*)\" \"(.*)\"/";
            $fields = array(
                2 => "score",
                3 => "deaths",
                4 => "time",
                6 => "rank",
                7 => "name");
        } elseif (strpos($server['b']['type'], "moh") !== false) // (PING) "(NAME)"
        {
            $pattern = "/(.*) \"(.*)\"/";
            $fields = array(1 => "ping", 2 => "name");
        } else // (SCORE) (PING) "(NAME)"
        {
            if (empty($rcon_pwd))
            {
                $pattern = "/(.*) (.*) \"(.*)\"/";
                $fields = array(
                    1 => "score",
                    2 => "ping",
                    3 => "name");
            } else
            {
                $part = $part2;
                $pattern = "/(\d+) +(\d+) +(\d+) +(\w+) +(.*)\^7 +(\d+) +(.*)/";
                $fields = array(
                    1 => "pid",
                    2 => "score",
                    3 => "ping",
                    4 => "guid",
                    5 => "name",
                    7 => "ip");
            }
        }
        //---------------------------------------------------------+
        foreach ($part as $player_key => $data)
        {
            if (!$data)
            {
                continue;
            }
            preg_match($pattern, $data, $match);
            foreach ($fields as $match_key => $field_name)
            {
                if (isset($match[$match_key]))
                {
                   if ($field_name != 'ip')
                    {
                        $server['p'][$player_key][$field_name] = trim($match[$match_key]);
                    } else
                    {
                        $server['p'][$player_key][$field_name] = preg_replace('/:.*/', '', trim($match[$match_key]));
                    }
                }
             //         $server['p'][$player_key]['name'] = lgsl_parse_color($server['p'][$player_key]['name'],"1"); // unused.
                if (isset($server['p'][$player_key]['time']))
                {
                    $server['p'][$player_key]['time'] = lgsl_time($server['p'][$player_key]['time']);
                }
            }

            //---------------------------------------------------------+
      //      print_r($server['p']); //for debug only

        }
        return true;
    }

    //------------------------------------------------------------------------------------------------------------+
    //------------------------------------------------------------------------------------------------------------+

ENG:
p.s.This modification for MW2 has appeared thanks to the enthusiasm of the Xsfd (M.D.A), I just modified the code to fully operational status.
RUS:
p.s. Мод для MW2 появился благодаря энтузиазму Xsfd (M.D.A), я же просто "допилил" код до полностью рабочего состояния.

http://bigshooter.ru
Website
 

Jump:     Back to top


You are not logged in - Click Here To Signup

Username:    Password:   

Mini Buttons

.... © GreyCube.com - Richard Perry - Powered by e107.org