1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Server Help Tools for server administration

Discussion in 'Multiplayer' started by Meuhmeuh, Dec 12, 2013.

  1. Mortalsinn

    Mortalsinn Zero Gravity Genie

    I see all these scripts that parse the log for information written in PHP and then inturn displayed on a webpage....but how does it work if your Game server and Web Server are on two different boxes

    I used to have this type of thing setup on my Minecraft server where my webpage displayed the names and number of users but I used a MySQL server to bridge the two where the minecraft plugins would write the data to a MySQL database and then I'd have some PHP action on my website reading the data from the MySQL database.

    Is this possible right now?
     
  2. Plnda

    Plnda Industrial Terraformer

    you can write a cron that inserts data in a database, so you could retrieve it on the other end. or the log file must be placed in a share and then can be accessed on the other server
     
  3. Meuhmeuh

    Meuhmeuh Seal Broken

    im working on this, adding information in database, and easily wipe logs with it
     
    danks_ likes this.
  4. Dtho_47

    Dtho_47 Star Wrangler

    It's cool ...
    But my knowledge of php too weak = (

    How to get remote access to the server through php?
     
  5. Meuhmeuh

    Meuhmeuh Seal Broken

    For the server status you can just put your ip and port, but for the analysis of the logs, you have 2 posibility.
    Using a bash which copy your logs server to your website server, or a script ta put in databse the information
     
  6. Plnda

    Plnda Industrial Terraformer

    or if you have two vps's you can create a virtual private network and share the file
     
  7. BMZ_G

    BMZ_G Poptop Tamer

    Shame you aren't doing it in Python :)
     
  8. Shirou

    Shirou Aquatic Astronaut

    Please no php is better
     
  9. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Phython you say?!?! Here ya go give this a look over.
     
    Last edited: Dec 14, 2013
  10. Scellow

    Scellow Subatomic Cosmonaut

    I'm trying to make a access to the chat log but for some reason it doesn't work

    PHP:
    // extract chat
    $chat = array();
    foreach (
    $logClients as $line) {
        if (
    preg_match('/<([0-9a-zA-Z-\s]*)>\s+([a-z].*)/i'$line$matches) == 1) {
            if (
    strlen($matches[1])) {
                
    $clients[$matches[1]] = trim($matches[2]);
            }
        }
    }

    Any help ? :)
     
  11. Shirou

    Shirou Aquatic Astronaut

    After this new patch the PHP code for players connected/online don't work anymore the one nithlon made.
     
  12. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    You can find updated tools, written in Python here. [Github Link] This will give you a list of connected users, and their I.P. Address, it is working with the latest release, Offended Koala.
     
  13. Shirou

    Shirou Aquatic Astronaut

    can this be placed on my website as a php file?
     
  14. Shirou

    Shirou Aquatic Astronaut

    When running it i keep getting

    Traceback (most recent call last):
    File "C:/Python27/Lib/who", line 104, in <module>
    main()
    File "C:/Python27/Lib/who", line 33, in main
    with open(STARBOUND_LOGFILE, 'r') as log:
    IOError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Steam\\SteamApps\\common\\Starbound'
     
  15. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    You will want to move your starbound directory out of the default location. Program Files\~ is a protected path in windows. You could run the script as administrator, but that is never smart ;p

    I use: C:\Steam\Steamapps\common\Starbound\starbound_server.log - as my Starbound directory path.

    The script is looking for the server.log file, and it can't read it at your current files path.
     
  16. Ripe

    Ripe Space Hobo

    Change this code:
    PHP:
    // only keep lines with client info
    $logClients array_filter($logLines, function($line) {
        return 
    preg_match('/^Info:.*<User/'$line);
    });

    // extract clients
    $clients = array();
    foreach (
    $logClients as $line) {
        if (
    preg_match('/<User: ([0-9a-zA-Z-\s]*)>\s+([a-z].*)/i'$line$matches) == 1) {
            if (
    strlen($matches[1])) {
                
    $clients[$matches[1]] = trim($matches[2]);
            }
        }
    }
    To:
    PHP:
    // only keep lines with client info
    $logClients array_filter($logLines, function($line) {
        return 
    preg_match('/^Info:.*Client/'$line);
    });

    // extract clients
    $clients = array();
    foreach (
    $logClients as $line) {
        if (
    preg_match('/.*?\\\'(.*)\\\'.*?\(.*?\)(.*)/i'$line$matches) == 1) {
            if (
    strlen($matches[1])) {
                
    $clients[$matches[1]] = trim($matches[2]);
            }
        }
    }
     
    Last edited: Dec 15, 2013
  17. Shirou

    Shirou Aquatic Astronaut

    Now we talking thanks Ripe! appreciate it, i never get how that python works, php is so easier and nicer :)
     
  18. Ripe

    Ripe Space Hobo

    Also something I've noticed is that script lacks is encoding.

    Believe it or not I can set my name to this and the status page will run that piece of code.
    [​IMG]

    Just change:
    PHP:
    <?php echo $client?>
    To:
    PHP:
    <?php echo htmlentities($client); ?>
    It's better we fix this now before these scripts become popular.
     
  19. danks_

    danks_ Existential Complex

    Say, Ripe... If I wanted to change not Daniel's but MeuhMeuh's file, should it look like this?
    (I haven't had time to run the server and check the logs, doing this blind, am most likely mistaken)

    PHP:
    if(preg_match("%Info: (.*) Client'([0-9a-zA-Z\s]*)>%i"$line$val)){
    Given that he started it with a " and not a ', it should work, right?
     
  20. Plnda

    Plnda Industrial Terraformer

    was there an update?
     

Share This Page