<?php
/*
Copyright (c) 2005 Sam J. Clarke
All rights reserved.

Script Name: Trace Route
Author Name: Sam J. Clarke
Author Email: admin@free-php.org.uk
Author URI: http://www.free-php.org.uk/
Description: This script will trace the route from your server to you.
Instructions: To use it copy all the code a put it
in a file called anything you want .php and put it
on your webserver. Then just run it, If you need
any help just email me.


LICENSE

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

To read the license please visit http://www.gnu.org/copyleft/gpl.html
*/
$nix true// change to true if useing *nix or change to false if using windows
$host getenv(REMOTE_ADDR); // get the ip address to trace
$host preg_replace ("/[^A-Za-z0-9.]/","",$host);// check it
$host escapeshellcmd($host);// make sure there no nasty stuff
print "Traceing route.........<br /><pre>";
if(
$nix) {
         
system ("traceroute $host"); // send command to *nix to trace the route
         
system("killall -q traceroute");
} else {
         
system("tracert $host"); // tell windows to trace the route
}
print 
"</pre>done";
?>