PHP

PHP-Trace

Installation:
Drop it into a directory, and call it. You will need execute-rights for this file.

What for?:
I dunno...just cool !.

Can I change it?:
Sure, just sent me back the changed script and let's share your bright ideas (I doubt that there is
much to add on, it's a simple script...).

It doesn't work, the error messages talks about a "fork?!?".
Great. There are two possible causes. First, you use the "win" version on Unix or the other way around.
Edit the script an check/change the $os variable.

Second, your webserver doesn't allow the execution of system command out of the script. Well, if you own
the server, you can change this in the php.ini or in the webserver settings. If you don't own the server,
it's bad. The script needs to call "system" to do the traceroute. Not much I can do...or you, other
than changing provider....

Support ??!
Hello, this isn't a compicated script. More likley you will have a problem with your PHP installation or
webserver, but not with the script itself...but if you really want to, write me or post your questions
at my little forum (http://www.theworldsend.net)

<?php
//  This script was writen by webmaster@theworldsend.net, Aug. 2001
//  check out my webpage with the newest stuff...around php and networking
//  http://www.theworldsend.net 
//  This is my second script. Enjoy.
//
//
$os = "win";   //os is "win" or "unix" (unix includes linux and friends)
//
// 
// Trace on unix already displays the hostnames, so we don't blend in the "resolve" option.
// If os = win, we put in a checkbox to ask for "resolve or not".
//
//  Put it into whatever directory and call it. That's all.
//
//
// nothing more to be done. 
//
If ($submit =="Trace!") 
{
  If (ereg(" ",$host)) 
  {
      echo 'No Space in Host field allowed !';
      echo '<a href="php-trace.php">Back</a>';
      $again= True;
  }
  else 
  {
       If ($host <> "")
       {
          echo("Traceroute Output:<br>"); 
          echo '<pre>';
          $host = escapeshellarg($host); 
          if ($os ="win") 
          {
               If ($resolve == "true") 
               {
                   system("tracert $host");
               }
               else
               {
                   system("tracert -d  $host");
               }; 
          }
          else
          {
               system("traceroute $host");
          };
          echo '</pre>';
       }
       else
       {
          echo 'You have not fill out the host field. Use your BACK button';
          echo 'to return to the form and enter an IP or Host';
       };
  };
}
else 
{
  echo '<html><body>';
  echo '<form methode="post" action="php-trace.php">';
  echo 'Enter IP or Host <input type="text" name="host"></input>';
  if ($os == "win") 
  {
     echo 'Resolve IPs ? <input type="checkbox" name="resolve" value="true" unchecked></input>';

  };
  echo '<input type="submit" name="submit" value="Trace!"></input>';
  echo '</form>';
  echo '</body></html>';
};
?>
  script
Похожие новости:
Добавлено: 22 Августа 2020 03:52:03 Добавил: Андрей Ковальчук
Добавить