Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   ping script required (https://www.cableforum.uk/board/showthread.php?t=4074)

handyman 07-11-2003 22:36

ping script required
 
Is there such a thing as a script I can run on a web page that will automatically run a ping test to a ip (either manually entered or capured auto).

Basically I am trying to get as many tools into my site as possible to enable people to try diagnose faults with out having to call in to tech support.

Thanks in advance
mark

Bifta 07-11-2003 22:59

Re: ping script required
 
Quote:

Originally Posted by handyman
Is there such a thing as a script I can run on a web page that will automatically run a ping test to a ip (either manually entered or capured auto).

Basically I am trying to get as many tools into my site as possible to enable people to try diagnose faults with out having to call in to tech support.

Thanks in advance
mark

Try this (PHP) (taken from worldsend)

Code:

<?php

$max_count = 10;
$unix      =  1; 
$windows  =  0;

$register_globals = (bool) ini_get('register_gobals');
$system = ini_get('system');
$unix = (bool) $unix;
$win  = (bool)  $windows;
//
If ($register_globals)
{
  $ip = getenv(REMOTE_ADDR);
  $self = $PHP_SELF;
}
else
{
  $submit = $_GET['submit'];
  $count  = $_GET['count'];
  $host  = $_GET['host'];
  $ip    = $_SERVER['REMOTE_ADDR'];
  $self  = $_SERVER['PHP_SELF'];
};

If ($submit == "Ping!")
{

  If ($count > $max_count)
  {
      echo 'Maximum for count is: '.$max_count;
      echo '<a href="'.$self.'">Back</a>';
  }
  else
  {

      $host= preg_replace ("/[^A-Za-z0-9.]/","",$host);
      echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
      echo("Ping Output:<br>");
      echo '<pre>';         

      if ($unix)
      {
        system ("ping -c$count -w$count $host");
        system("killall ping");
      }
      else
      {
        system("ping -n $count $host");
      }
      echo '</pre>';
    }
}
else
{
    echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
    echo '<p><font size="2">Your IP is: '.$ip.'</font></p>';
    echo '<form methode="post" action="'.$self.'">';
    echo '  Enter IP or Host <input type="text" name="host" value="'.$ip.'"></input>';
    echo '  Enter Count <input type="text" name="count" size="2" value="4"></input>';
    echo '  <input type="submit" name="submit" value="Ping!"></input>';
    echo '</form>';
    echo '<br><b>'.$system.'</b>';
    echo '</body></html>';
}
?>


willie 07-11-2003 23:02

Re: ping script required
 
Some scripts that may help http://www.theworldsend.net/

homealone 07-11-2003 23:03

Re: ping script required
 
Quote:

Originally Posted by handyman
Is there such a thing as a script I can run on a web page that will automatically run a ping test to a ip (either manually entered or capured auto).

Basically I am trying to get as many tools into my site as possible to enable people to try diagnose faults with out having to call in to tech support.

Thanks in advance
mark

dunno - but the site is looking really good:)

handyman 07-11-2003 23:28

Re: ping script required
 
cheers guys that looks just what I am after.

and fanks gaz, ur tin should have been posted yesterday by bops gf :)


All times are GMT +1. The time now is 17:43.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum