Hello,
I am new to PHP, but not new to programming. I started with something simple, traceroute. I borrowed this from another site and reconfigured it to run on unix. The script workes fine but what I want it to do, is stop looking after it reaches my ip address. It will trace from my server to my isp quickly, but then it hangs around still looking for something else, goes through a total of thirty lines before it prints done..., I looked at some reference for killall and I don't see -q anywhere, does anyone know what this means? Or can you help me figure out how to kill the traceroute after it finds my isp?
<?php
$system = ini_get('system');
$ip = $_SERVER['REMOTE_ADDR'];
$self = $_SERVER['PHP_SELF'];
if (!empty($_POST))
{
$host = $_POST['host'];
$host= preg_replace ("/[^A-Za-z0-9.]/","",$host);
echo("Trace Output:<br>");
echo '<pre>';
system ("traceroute $host");
system("killall -q traceroute");
echo '</pre>';
echo 'done ...';
}
else
{
echo '<p>Your IP is: '.$ip.'/p>';
echo '<form method="post" action="'.$self.'">';
echo 'Enter IP or Host <input type="text" name="host" value="'.$ip.'"></input>';
echo '<input type="submit" name="submit" value="Traceroute"></input>';
echo '</form>';
}
?>