A3 mmorpg Wiki
Advertisement

This is a script I discovered in my PHP projects folder, I did not write this and I don't remember where I got it from in order to give proper credits.


 <h1>server check</h1> 
 <p><?php 
 function server2($server, $port, $name) { 
  preg_match("/^(http:\/\/)?([^\/]+)/i", "$server", $match); 
  $host = $match[2]; 
  preg_match_all("/\.([^\.\/]+)/",$host, $match); 
 
  $matches[0][0] = $matches[1][0]; 
  $host = trim($host); 
 
  $socket = ""; 
  @$socket = fsockopen("$host", $port, $errno, $errstr, 2); 
  if(!$socket) { 
   $socket = print("\n<br /><font color=\"red\">No responce from $name $host!</font>"); 
  } else { 
   fclose($socket); 
   $socket = print("\n<br /><font color=\"green\">$host $name OK!</font>"); 
  } 
 } 
 
 
 $server=$_GET['server']; 
 if($server!=""){ 
 server2($server,"7770","7770"); 
 server2($server,"8880","8880"); 
 server2($server,"9990","9990"); 
 server2($server,"8811","LoginAgent"); 
 server2($server,"6689","Zoneserver"); 
 server2($server,"7789","Mainserver"); 
 server2($server,"6999","Battleserver"); 
 } 
 else 
 { 
 $a=$_SERVER['PHP_SELF']; 
 ?> 
 <form action="<?php echo $a; ?>" method="get"> 
 <input type="text" name="server" value="">Server-url<br /> 
 <input type="submit" value="check"> 
 </form> 
 <?php 
 } 
 ?>
 
  

HTH

Advertisement