I'm Very, very, new at working with PhP Code, and while I found what I was looking for online at a site for people that play the game in question, I'm very lost as to how to tie this into the main index page As I'm not exactly sure what is needed..
You can see the script Working here, the actual script is below. I'd be grateful for any help ya'll can give me. I think I have to strip out the HTML coding, to even display it on the index.php file, but with my lack of knowlage, I've avoided tampering with it for now.
<html> <head> <body background="#0B283B" text="#000000" link="#00CCFF" vlink="#0099CC" alink="#FFFFFF"> <title>Zhentil Keep</title> <style type="text/css"> <!-- .r { } --> </style> </head> <body background="#0B283B" text="#000000" link="#00CCFF" vlink="#0099CC" alink="#FFFFFF"> <center> <?php $ipaddr = "213.239.184.150"; $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( "<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>Players:</u> <i class='r'>$lines[5]</i> / <i class='r'>$lines[6]</i><br><br>\n" ); $dlines = explode( "\n", $lines[15] ); foreach ( $dlines as $dline ) { } print( "</i>\n" ); } } fclose( $connect ); ?> </center> </body> </html>
Comment