serverstatus script not working
Knight_Shield
Member Posts: 51
I have a server status script for awhile. I just tried it on my EE server and it says server down. The IP address in the script is not my server IP , it is a sample.
<html>
<head>
<body background="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<title>Name of Server</title>
<style type="text/css">
<!--
.r {
color: #00ff00;
}
-->
</style>
</head>
<body>
<center>
<?php
$ipaddr = "12.34.56.78";
$port = "5121";
$timeout = 5;
$connect = fsockopen( "udp://" . $ipaddr, $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 );
print( "<u>Server IP:</u> <i class='r'>$ipaddr</i>:<i class='r'>$port</i><br>\n" );
print( "<u>Server Status:</u> <i class='r'>Online</i><br>\n" );
print( "<b>Game Category:</b> <i class='r'>" );
if ( $lines[16] == "274" ) {
print( "Action</i><br>\n" );
} elseif ( $lines[16] == "363" ) {
print( "Story</i><br>\n" );
} elseif ( $lines[16] == "364" ) {
print( "Story Lite</i><br>\n" );
} elseif ( $lines[16] == "275" ) {
print( "Role Play</i><br>\n" );
} elseif ( $lines[16] == "276" ) {
print( "Team</i><br>\n" );
} elseif ( $lines[16] == "365" ) {
print( "Melee</i><br>\n" );
} elseif ( $lines[16] == "366" ) {
print( "Arena</i><br>\n" );
} elseif ( $lines[16] == "277" ) {
print( "Social</i><br>\n" );
} elseif ( $lines[16] == "279" ) {
print( "Alternative</i><br>\n" );
} elseif ( $lines[16] == "278" ) {
print( "PW Action</i><br>\n" );
} elseif ( $lines[16] == "367" ) {
print( "PW Story</i><br>\n" );
} elseif ( $lines[16] == "368" ) {
print( "Solo</i><br>\n" );
} elseif ( $lines[16] == "370" ) {
print( "Tech Support</i><br>\n" );
}
print( "<u>Play Type:</u> <i class='r'>$lines[2]</i><br>\n" );
print( "<u>Game Name:</u> <i class='r'>$lines[3]</i><br>\n" );
print( "<u>Module Name:</u> <i class='r'>$lines[4]</i><br>\n" );
print( "<u>Version Number:</u> <i class='r'>$lines[14]" );
if ( $lines[20] == '1' ) {
print( " / XP-1 " );
} elseif ( $lines[20] == '2' ) {
print( " / XP-2 " );
} elseif ( $lines[20] == '3') {
print( " / XP-1 / XP-2 " );
}
print( "</i><br><br>\n" );
print( "<u>Level Range:</u> <i class='r'>$lines[7]</i> - <i class='r'>$lines[8]</i><br>\n" );
print( "<u>Player vs. Player:</u> " );
if ( $lines[9] == "NONE" ) {
print( "<i class='r'>" );
} elseif ( $lines[9] == "FULL" ) {
print( "<i class='r'>" );
} else {
print( "<i class='r'>" );
}
print( "$lines[9]</i><br>\n" );
print( "<u>Character Vault:</u> " );
if ( $lines[19] == '1' ) {
print( "<i class='r'>Local Vault</i><br>\n" );
} else {
print( "<i class='r'>Server Vault</i><br>\n" );
}
print( "<u>Only One Party:</u> " );
if ( $lines[12] == '1' ) {
print( "<i class='r'>enabled</i><br>\n" );
} else {
print( "<i class='r'>disabled</i><br>\n" );
}
print( "<u>Player Pause:</u> " );
if ( $lines[13] == '1' ) {
print( "<i class='r'>enabled</i><br>\n" );
} else {
print( "<i class='r'>disabled</i><br>\n" );
}
print( "<u>Item Level Restrictions:</u> " );
if ( $lines[18] == '1' ) {
print( "<i class='r'>enabled</i><br>\n" );
} else {
print( "<i class='r'>disabled</i><br>\n" );
}
print( "<u>Enforce Legal Characters:</u> " );
if ( $lines[17] == '1' ) {
print( "<i class='r'>enabled</i><br>\n" );
} else {
print( "<i class='r'>disabled</i><br>\n" );
}
print( "<u>Password:</u> " );
if ( $lines[10] == '0' ) {
print( "<i class='r'>not required</i><br>\n" );
} else {
print( "<i class='r'>required</i><br>\n" );
}
print( "<u>Players:</u> <i class='r'>$lines[5]</i> / <i class='r'>$lines[6]</i><br><br>\n" );
$dlines = explode( "\n", $lines[15] );
print( "<u>Server Description:</u><br>" );
print( "<i>\n" );
foreach ( $dlines as $dline ) {
print( "$dline<br>\n" );
}
print( "</i>\n" );
}
}
fclose( $connect );
?>
</center>
</body>
</html>
0
Comments
If it's still happening, please, report on support.baldursgate.com