Author Topic: Server Status Script For Websites.  (Read 4449 times)

Smokey

  • Autococker
  • Posts: 1172
Server Status Script For Websites.
« on: July 09, 2007, 01:11:57 PM »
I have made a small script for clans and other groups to display server status on their websites.

The information can be included in your page via an iframe, or a
Code: [Select]
<?PHP  file_get_contents("http://www.zilla-clan.net/dpq/?ip=12.34.56.789&port=27910");
?>
The source is available upon Request.

Usage: http://www.zilla-clan.net/dpq/?ip=SERVERIP&port=SERVERPORT

Example:
http://www.zilla-clan.net/dpq/?ip=70.85.9.178&port=27922

The look of it (link color, font) can be modified by adding the desired style to a div class called "stats" to your CSS.
 ;)
« Last Edit: July 11, 2007, 11:57:52 AM by Smokey »

T3RR0R15T

  • Map Committee
  • Autococker
  • Posts: 2593
Re: Server Status Script For Websites.
« Reply #1 on: July 09, 2007, 01:54:52 PM »
Nice, can u make the playerlist too?

y00tz

  • Autococker
  • Posts: 2742
Re: Server Status Script For Websites.
« Reply #2 on: July 09, 2007, 01:57:08 PM »
Awesome Smokey :D :D

I made something like this but it requires PHP5... something a lot of servers don't run yet.

Smokey

  • Autococker
  • Posts: 1172
Re: Server Status Script For Websites.
« Reply #3 on: July 09, 2007, 02:14:47 PM »
Awesome Smokey :D :D

I made something like this but it requires PHP5... something a lot of servers don't run yet.
Well, the whole point of this is that clans who don't have php enabled websites (lol) or don't know how to use it and such can just use that :)

As for the playerlist, meh. I'll see what I can come up with :)

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: Server Status Script For Websites.
« Reply #4 on: July 09, 2007, 02:46:51 PM »
Good Job Smokey.

Smokey

  • Autococker
  • Posts: 1172
Re: Server Status Script For Websites.
« Reply #5 on: July 09, 2007, 03:13:28 PM »
Doesn't load lekky :)

Edit:
webSPELL version: 4.01.02
PHP version: 4.4.1
MySQL version:

ERROR: Can not connect to MySQL-Server

lekky

  • Autococker
  • Posts: 2449
Re: Server Status Script For Websites.
« Reply #6 on: July 09, 2007, 03:36:55 PM »

Smokey

  • Autococker
  • Posts: 1172
Re: Server Status Script For Websites.
« Reply #7 on: July 09, 2007, 04:02:23 PM »
:P

http://qehs.indiereview.co.uk/webspell/index.php?site=server_stats

It's a dajoob so I wondered if it was you?
Whats the direct URL? It probably is mine though, lol.

Zorchenhimer

  • Autococker
  • Posts: 2614
Re: Server Status Script For Websites.
« Reply #8 on: July 09, 2007, 04:13:38 PM »
http://qehs.indiereview.co.uk/webspell/index.php?site=server_stats

You might want to strip the funnames for the player list. Those make it hard to read.

Smokey

  • Autococker
  • Posts: 1172
Re: Server Status Script For Websites.
« Reply #9 on: July 09, 2007, 04:54:47 PM »
http://qehs.indiereview.co.uk/webspell/index.php?site=server_stats

You might want to strip the funnames for the player list. Those make it hard to read.
Yea, I'm going to figure out a way to do that and include it in this.

Cobo

  • Autococker
  • Posts: 1362
Re: Server Status Script For Websites.
« Reply #10 on: July 09, 2007, 05:05:55 PM »
Take a look at the server browser code. Since it basicly does what you want to do with every server.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Server Status Script For Websites.
« Reply #11 on: July 09, 2007, 06:14:54 PM »
Code: [Select]
$char_remap =
        "\0---_*t.N-\n#.>**".
        "[]@@@@@@<>.-*---".
        " !\"#\$%&'()*+,-./".
        "0123456789:;<=>?".
        "@ABCDEFGHIJKLMNO".
        "PQRSTUVWXYZ[\\]^_".
        "`abcdefghijklmno".
        "pqrstuvwxyz{|}~<".
        "(=)^!OUICCR#?>**".
        "[]@@@@@@<>*X*---".
        " !\"#\$%&'()*+,-./".
        "0123456789:;<=>?".
        "@ABCDEFGHIJKLMNO".
        "PQRSTUVWXYZ[\\]^_".
        "`ABCDEFGHIJKLMNO".
        "PQRSTUVWXYZ{|}~<";


// strip out the garbage characters such as color codes
// and map extended ascii to something readable...
function strip_garbage ($instr) {
        $outstr = "";
        $len = strlen($instr);
        global $char_remap;
        for ($i = 0; $i < $len; $i++) {
                $c = ord($instr[$i]);
                switch ($c) {
                case CHAR_COLOR:
                        $i++;
                        break;
                case CHAR_ITALICS:
                case CHAR_UNDERLINE:
                case CHAR_ENDFORMAT:
                        break;
                default:
                        $outstr .= $char_remap[$c];
                }
        }
        return $outstr;
}


Smokey

  • Autococker
  • Posts: 1172
Re: Server Status Script For Websites.
« Reply #12 on: July 10, 2007, 09:58:51 AM »
Eww, What are you using to format your code? Thats ugly stuff :)


But thanks <3

Eiii

  • Autococker
  • Posts: 4595
Re: Server Status Script For Websites.
« Reply #13 on: July 10, 2007, 02:29:07 PM »
It might be nice if you included the values of CHAR_ITALICS, etc.

Cobo

  • Autococker
  • Posts: 1362
Re: Server Status Script For Websites.
« Reply #14 on: July 10, 2007, 04:38:55 PM »
Easy to do on php, but pretty hard on c, for what I know.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Server Status Script For Websites.
« Reply #15 on: July 10, 2007, 06:54:04 PM »
Good point, Eiii:

Code: [Select]
define("CHAR_ENDFORMAT", 133);
define("CHAR_UNDERLINE", 134);
define("CHAR_ITALICS", 135);
define("CHAR_COLOR", 136);

Smokey: What's ugly, tab indents? :P  My PHP coding style is pretty compact.  I have a lot more whitespace in C code since it's usually harder to follow.

Cobo: I think the C version of this function may actually be simpler.

Cobo

  • Autococker
  • Posts: 1362
Re: Server Status Script For Websites.
« Reply #16 on: July 10, 2007, 07:40:49 PM »
:-\ Well, I dont even know how to make part of a word in italics/underline/color on c. Just a whole word. In PHP that just means adding something like <i> tags.

« Last Edit: July 10, 2007, 08:18:14 PM by Cobo »

Smokey

  • Autococker
  • Posts: 1172
Re: Server Status Script For Websites.
« Reply #17 on: July 10, 2007, 08:04:06 PM »
Smokey: What's ugly, tab indents? :P  My PHP coding style is pretty compact.  I have a lot more whitespace in C code since it's usually harder to follow.
The whitespace is the ugly part. :)


Source: http://zilla-clan.net/dpq/source.php

Cobo

  • Autococker
  • Posts: 1362
Re: Server Status Script For Websites.
« Reply #18 on: July 10, 2007, 08:18:24 PM »
Oh... I just noticed that Eiii meant the definitions of the characters :P
Silly me.  :-[

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: Server Status Script For Websites.
« Reply #19 on: July 11, 2007, 11:51:31 AM »
By the way, never include() an external URL in PHP. It will actually execute any PHP code on that page, and you obviously can realize the risk if the server maintainer turns evil or the server is hacked.

file_get_contents() is the way to go (or fsockopen(), feof(), fread(), fclose() if your version of PHP is that old).