A little piece of code I created to do an accurate server check for world of warcraft private servers of World of Chris.
<?phpfunction flush_buffers() {ob_end_flush();ob_flush();flush();ob_start();}// create a list of servers + ports to be checked$servers = array(array("Zul'Aman 2.4.3", "server4.wocserver.org", "8420", 2),array("Allakhazam BG 2.4.3", "server3.wocserver.org", "8199", 2),array("Menethil 3.1.x", "server3.wocserver.org", "8129", 2),array("Kil'Jaeden 3.1.x", "server2.wocserver.org", "1337", 2));ob_start();echo "<table border=\"0\" width=\"500\">\n";foreach($servers as $server) {$status = (checkServer($server[1],$server[2],$server[3])?"online":"offline");echo "<tr><td width=\"170\" align=\"right\"><img style=\"margin-bottom: 1px;\" src=\"".$status.".gif\" alt=\"".$status."\" align=\"absmiddle\" /></td><td>".$server[0]."</td></tr>\n";flush_buffers();}echo "</table>";// check for a connection on the given server / port and return booleanfunction checkServer($server, $port, $timeout = 2) {$fp = @fsockopen($server, $port, $errno, $errstr, $timeout);if(!$fp)return false;else {fclose($fp);return true;}}?>- Download this code: servercheck.txt
Example of this script can be found at www.dotcomgoed.nl/woc/.
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.