Daimonin MMORPG Logo
Daimonin voting system

Recent Posts

[Graphics requests] Canoe by ThePlaneskeeper
Today at 04:07:09 am
[Daimonin project] "Silent" quests by smacky
July 29, 2010, 10:29:23 pm
[Community chat] Social Network - Daimonin Pages by Nite_Star
July 29, 2010, 05:50:17 pm
[Bug discussion] SENTInce AddLink() limit by _people_
July 29, 2010, 05:29:21 pm
[Graphics] Treant Corpse by _people_
July 28, 2010, 07:06:02 pm
[Suggestions] Areas with Dropped Item Saving by UrAvgAzn
July 28, 2010, 03:21:23 pm
[Suggestions] Coin Amount Image Scaling by smacky
July 28, 2010, 11:32:02 am
[Community chat] TPK's Server down for maintenance by ThePlaneskeeper
July 28, 2010, 04:11:07 am

Daimonin Forums

 
Pages: [1]   Go Down
  Print  
Author Topic: display of number of players on active game servers  (Read 1510 times)
LordGrunt
Elite Moroch servant
*
*
*
*
*
*
*



Posts: 458
Karma: +12/-2


View Profile
« on: August 29, 2009, 09:14:17 pm »

Weee, thats a long title. Should be even longer, thing is to display it on this website side panel.
As some of you are aware, we can access these numbers by reading contents of this link:
http://www.daimonin.org:13326/
But... doing that in interactive way is a different matter. If one wants to read it from inside of php script, there are several ways.
1. fopen function
1. curl, if present
2. fsocket stuff

1) easiest to use, though its forbidden on most servers. so let's skip it.
2) curl, if present (and it should be on most servers) gives more options in this matter. but it also requiring much more coding/scripting in php
3) honestly, i didnt dig in to it yet

so, while this curl thing seems complicated, its possible, and in the effect we could have number of players online read from above URL address to be a part of this website's side panels. AFAIK, we had that a while ago, on previous site. It'd be great to have it back.

This post really happened only because i've found a nice script simplifying curl access to URL contents. And its tested, as far as I could on my local apache ;)

The only concern I have about it is that in the case of game server not running (I assume its the origin of port 13326 being open), website would load very long, with eventual errors.

I'm not sure if I could pull up this script to be aware of game server being active or not, so emedding its code to this site would be just a rush, but if someone else is interested in reviving this functionality, im hope it's possible for it to be working again.
There's the script: http://codepad.org/ZkfT7sIn (technically, it will read both curl and fsocket, whichever is available) and I also wrote small dissasembling script to read player numbers from 13326 port contents.
smacky
The Singular Soul of Lom Lobon Tribe
*
*
*
*
*
*
*



Posts: 6774
Karma: +246/-130


View Profile
« Reply #1 on: August 30, 2009, 06:23:37 pm »

I don't understand anything after the first paragraph. :happy:

Nevertheless, I implemented this as a Daipedia action. Well, nearly.

Here's the php (it's basic to test if the idea would work at all):
Code: [Select]
<?php
$METASERVER 
"http://www.daimonin.org:13326/";

$output "<div>";
$data file_get_contents($METASERVER);

if (
$data === FALSE)
    
$output .= "<em class=\"error\">Metaserver unreachable</em>";
else
{
    
$output .= "<table>";
    
$output .= "<tr>";
    
$output .= "<th>?</th>";
    
$output .= "<th>Name</th>";
    
$output .= "<th>Address</th>";
    
$output .= "<th>Port</th>";
    
$output .= "<th>Version</th>";
    
$output .= "<th>Players</th>";
    
$output .= "<th>Info</th>";
    
$output .= "</tr>";
    
$lines explode("\n"$data);

    foreach (
$lines as $line)
    {
        
$datum explode("|"$line);
        
$output .= "<tr>";
        
$output .= "<td>$datum[0]</td>";
        
$output .= "<td>$datum[1]</td>";
        
$output .= "<td>$datum[2]</td>";
        
$output .= "<td>$datum[3]</td>";
        
$output .= "<td>$datum[4]</td>";
        
$output .= "<td>$datum[5]</td>";
        
$output .= "<td>$datum[6]</td>";
        
$output .= "</tr>";
    }

    
$output .= "</table>";
}

$output .= "</div>";

echo 
$this->ReturnSafeHTML($output);
?>


To use, you would include {{metaserver}} on your page.

But the theme we use (no idea where this originates) can't seem to handle URLs with ports: http://www.daimonin.org:13326/ just generates PHP errors, but http://www.daimonin.org/ embeds the HTML in the Daipedia page (not what is wanted, but it proves it works with no port).
LordGrunt
Elite Moroch servant
*
*
*
*
*
*
*



Posts: 458
Karma: +12/-2


View Profile
« Reply #2 on: September 06, 2009, 04:05:39 pm »

there is another aproach. instead of modifying website code, we (users) can change what browser is displaying.
requirements: greasemonkey plugin (firefox only?)
and this script i created with a lot of sweat ;) :
http://lordgrunt.myplus.org/?lang=en&page=5
the code is a mess, but it works.
this script is set to work on all parts of daimonin website except forums, as there is no user list on left side panel, so there is nothing to replace.
example:
LordGrunt
Elite Moroch servant
*
*
*
*
*
*
*



Posts: 458
Karma: +12/-2


View Profile
« Reply #3 on: October 18, 2009, 06:03:54 pm »

bump!

I noticed my downloads section was accessed several times, but I have no means to log download count atm. I was wondering if anyone actually tried it yet, found it useful maybe?
Mizza
Ancient bone dragon
*
*



Posts: 235
Karma: +11/-2


View Profile
« Reply #4 on: October 25, 2009, 02:56:17 pm »

The Greasemonkey script is a great (temporary) solution. ;D
This was a feature in the future, maybe it should be again. :)
--Mizza
LordGrunt
Elite Moroch servant
*
*
*
*
*
*
*



Posts: 458
Karma: +12/-2


View Profile
« Reply #5 on: January 10, 2010, 07:41:56 pm »

im glad someone liked it :)
Pages: [1]   Go Up
 
 

Powered by SMF 2.0 RC1-1 | SMF © 2006–2008, Simple Machines LLC
Page created in 0.113 seconds with 20 queries.