PHP Ping

Ping

<?php
//  This script was writen by webmaster@theworldsend.net, Aug. 2001
//  http://www.theworldsend.net 
//  This is my first script. Enjoy.
//  
// Put it into whatever directory and call it. That's all.
//
//-------------------------
$max_count = "10";  //maximum count for ping command
//$cmd = "ping -t";   // unix (unix means all flavors of linux as well)
$cmd = "ping -n";   // windows
//$cmd = "tping -c";   // netware
// -------------------------
//
// nothing more to be done. 
If (isset($_POST['submit'])) { 
  If ($_POST['count'] > $max_count) 
  {
     echo 'Maximum for count is '.$max_count;
     echo '<a href="php-ping.php">Back</a>';
     $again = True;
  }
  else 
  {
     If (ereg(" ",$_POST['host']))  
     {
          echo 'No Space in Host field allowed !';
          echo '<a href="php-ping.php">Back</a>';
          $again= True;
     }
     else 
     {
          echo("<b><font color=\"00cf10\">Ping Output:</font></b><br>"); 
          echo("<pre>");
          // $host = escapeshellarg($_POST['host']); 
          // $count = escapeshellarg($_POST['count']);
          $host = $_POST['host']; 
          $count = $_POST['count'];
          // print"$cmd $count $host";
          system("$cmd $count $host", $list);
          echo("</pre>");
      }
   }
} 
else 
{

?>

  <html><body>
  <h3><font color=\"00cf10\">Ping to another host</font></h3>
  <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  Enter IP or Host <input type="text" name="host"></input>
  Enter Count <input type="text" name="count" size="2" value="4"></input>
  <input type="submit" name="submit" value="Ping!"></input>
  </form>
<?php
}
?>
</body></html>