Game Server Status Script

He has: 34 posts

Joined: Nov 2003

I'm not sure if this would be the correct place to ask this question, but I though someone out there has made this work before.

One of my clients is trying to show their UnrealTournament server status on their main page. They are looking for what map is in use and who is currently in the game.

Postnuke CMS is currently in use, which uses PHP and MySQL. I can enable ASP and/or PERL for their account if there is a script that would work.

Anyone have any ideas?

Just for the record, just about any UnrealTournament Admin trype site that shows up in Google has been gone through, and still no luck. That is the main reason I am trying to help them out.

Thanks!

Brad Arnold

He has: 1,758 posts

Joined: Jul 2002

Assuming the server has an IP address, just ping the server on each pageload and if you get a response you know its working, otherwise you can safely assume that its probably not. That can easily be done from within a php script. I don't know if its the most efficiant way, but its one way of doing it I guess...

Also, I did a little search on google and foud this snippet which might do what you want...

<?php
/* ---------------------------------------------- */
/* ------------ BEGIN PHP SNIPPET ----------------*/
/* ---------------------------------------------- */

preg_match(\"/^(http:\/\/)?([^\/]+)/i\", \"$link_url\", $matches);
$host = $matches[2];

// get all but one segments of host name
preg_match_all(\"/\.([^\.\/]+)/\",
$host,$matches);

// first element does not want the period()
$matches[0][0] = $matches[1][0];
$url_host = implode('',$matches[0]);
// echo \"Domain:
$url_host - Host: $host\";

$host = trim($host);
$noc = \"\";
$noc = fsockopen(\"$host\", 80, $errno, $errstr, 15);
if(!
$noc) {
$noc = print(\"<img border=0 src=\\"dead.gif\\" align=\\"left\\">$host - Server not responding or very slow\");
} else {
fclose(
$noc);
$noc = print(\"<img border=0 src=\\"live.gif\\" align=\\"left\\">$host - Server running normally\");
}


?>

(from http://www.snipe.net/geek/toolz/server.php)

Andy

He has: 34 posts

Joined: Nov 2003

Very nice. I'll start playing around with that in just a few minitues, thanks for the help!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.