Jump to content


Photo

Server Status web page


  • Please log in to reply
4 replies to this topic

#1 muaddib

muaddib
  • Member
  • 58 posts

Posted 21 March 2005 - 09:59 AM

Dose anyone know of or have a way of publishing server status as well as maybe a seperate admin or DM page for admining the server from a .php page? I have looked all over the internet but all i can find is one for a linux server. I run win 2003 and this will not work for me. Any and all help would be greatly appriciated.

#2 Tiggerlicker

Tiggerlicker
  • Member
  • 29 posts

Posted 21 March 2005 - 11:22 AM

AFAIK there isn't a good PHP (or ASP) system setup to manage the server through the web for Windows servers. However there are a few ways to get server and player info published to a webpage so that players will know the operational status of the server and online players.

I use this code in a PHP page to show the online status and some of the server details:

<html>
<head>
<title>Server Name Here</title>
<style type="text/css">
<!--
.r {
	color: #ff0000;
}
.b {
	color: #0000ff;
}
.g {
	color: #009933;
}
-->
</style>
</head>
<body>
 
<?php 
//Fill in the server IP in place of the xxx.xxx.xxx.xxx
//Fill in the server port in place of the nnnn
$default_ip = "xxx.xxx.xxx.xxxx";
$default_port = "nnnn";
$timeout = 5;
// check for form values
$ip = (isset($_GET['ip'])) ? ($_GET['ip']) : $default_ip;
$port = (isset($_GET['port'])) ? ($_GET['port']) : $default_port;
$connect = fsockopen( "udp://" . $ip, $port, $errno, $errstr, $timeout );
if ( ! $connect )	{
	print( "<h1>Server is down</h1><br>\n" );
	print( "<h3>ERROR: $errno - $errstr</h3><br>\n" );
	exit;
} else {
	socket_set_timeout( $connect, $timeout );
	$send = "\xFE\xFD\x00\xE0\xEB\x2D\x0E\x14\x01\x0B\x01\x05\x08\x0A\x33\x34\x35\x13\x04\x36\x37\x38\x39\x14\x3A\x3B\x3C\x3D\x00\x00";
	fwrite( $connect, $send );
	$output = fread( $connect, 5000 );
	if ( ! $output ) {
  print ( "<h1>Server is down.<br></h1>\n" );
	} else {
  $lines = explode( "\x00", $output );
  //Fill in the server IP in place of the xxx.xxx.xxx.xxx
  //Fill in the server port in place of the nnnn
  print( "<b><font=arial>Server IP:</b> <b class='b'>xxx.xxx.xxx.xxx</b><b>:</b><b class='b'>nnnn</b></font><br>\n" );
  print( "<b>Server Status:</b> <b class='g'>Online</b><br>\n" );	
  print( "<b>Play Type:</b> <b class='b'>$lines[2]</b><br>\n" );
  print( "<b>Game Name:</b> <b class='b'>$lines[3]</b><br>\n" );
  print( "<b>Module Name:</b> <b class='b'>$lines[4]</b><br>\n" );
  print( "<b>Version Number:</b> <b class='b'>$lines[14]" );
  if ( $lines[20] == '1' ) {
 	 print( " XP-1" );
  }
  print( "</b><br><br>\n" );
  
  print( "<b>Level Range:</b> <b class='b'>$lines[7]</b><b> - </b><b class='b'>$lines[8]</b><br>\n" );
  
  print( "<b>Player vs. Player:</b> " );
  if ( $lines[9] == "NONE" ) {
 	 print( "<b class='g'>" );
  } elseif ( $lines[9] == "FULL" ) {
 	 print( "<b class='r'>" );
  } else {
 	 print( "<b class='b'>" );
  }
  print( "$lines[9]</b><br>\n" );
  
  print( "<b>Character Vault:</b> " );
  if ( $lines[19] == '1' ) {
 	 print( "<b class='b'>Local Vault</b><br>\n" );
  } else {
 	 print( "<b class='b'>Server Vault</b><br>\n" );
  }
  print( "<b>Only One Party:</b> " );
  if ( $lines[12] == '1' ) {
 	 print( "<b class='g'>enabled</b><br>\n" );
  } else {
 	 print( "<b class='r'>disabled</b><br>\n" );
  }
  
  print( "<b>Player Pause:</b> " );
  if ( $lines[13] == '1' ) {
 	 print( "<b class='g'>enabled</b><br>\n" );
  } else {
 	 print( "<b class='r'>disabled</b><br>\n" );
  }
  
  print( "<b>ILR:</b> " );
  if ( $lines[18] == '1' ) {
 	 print( "<b class='g'>enabled</b><br>\n" );
  } else {
 	 print( "<b class='r'>disabled</b><br>\n" );
  }
  print( "<b>ELC:</b> " );
  if ( $lines[17] == '1' ) {
 	 print( "<b class='g'>enabled</b><br>\n" );
  } else {
 	 print( "<b class='r'>disabled</b><br>\n" );
  }
  
  print( "<b>Password:</b> " );
  if ( $lines[10] == '0' ) {
 	 print( "<b class='g'>not required</b><br>\n" );
  } else {
 	 print( "<b class='r'>required</b><br>\n" );
  }
  
  print( "<b>Players:</b> <b class='b'>$lines[5]</b><b>/</b><b class='b'>$lines[6]</b><br><br>\n" );
  $dlines = explode( "\n", $lines[15] );
  print( "<b>Server Description:</b><br>" );
  print( "<b>\n" );
  foreach ( $dlines as $dline ) {
 	 print( "$dline<br>\n" );
  }
  print( "</b>\n" );
	}
}
fclose( $connect ); 	 
?>

</body>
</html>

This should give an output like this:

Posted Image

Showing the actual players online is a different story...the module needs to be able to put the players into a MySQL table and then have the PHP page run a query to output the player information (i.e. Player names, levels, etc). I don't have that code available at my fingertips at this time :(

Edited by Tiggerlicker, 21 March 2005 - 11:34 AM.


#3 muaddib

muaddib
  • Member
  • 58 posts

Posted 21 March 2005 - 12:15 PM

Thx for the help. Atleast that is a start and if i cannot find one then i guess ill have to build one.

#4 -Guest_Leutian_*-

-Guest_Leutian_*-
  • Guest

Posted 21 March 2005 - 02:47 PM

Thx for the help. Atleast that is a start and if i cannot find one then i guess ill have to build one.

View Post

take a look at the web pages for the NEW nordock PR this might help

Nordock PR Website

#5 -Guest_Leutian_*-

-Guest_Leutian_*-
  • Guest

Posted 21 March 2005 - 02:48 PM

Thx for the help. Atleast that is a start and if i cannot find one then i guess ill have to build one.

View Post

take a look at the web pages for the NEW nordock PR this might help

Nordock PR Website

View Post

oh i forgot to mention specificly the part having to do with the Web Project.