I make the traceroute web based. I use shell_exec to execute the process and show the output via browser. I have problem with the first I call the page on browser. There is usage of tracert command show. I try to hide it by place the script inside the function. yes, it works but another element like map when I start load the page doesn't show. Here is my php code :
<html>
<head>
<title></title>
<body>
<?
$host = @$_POST['host'];
$trace = @$_POST['trace'];
$self = $_SERVER['PHP_SELF'];
?>
...
<form name="tools" action="<?php $self ?>" method="post">
<p><font size="2">Your IP is <?php $ip ?> </font></p>
<input type="text" name="host" value=""></input>
<input type="submit" name="trace" value="Traceroute!"></input>
</form>
<?php
if ($_POST['submit'])
{
if (($host == 'Enter Host or IP') || ($host == "")) {
echo '<br><br>You must enter a valid Host or IP address.';
exit; }
if(eregi("^[a-z]", $host))
{
$host_name = $host;
$host_ip = gethostbyname($host);
}
else
{
$host_name = gethostbyaddr($host);
$host_ip = $host;
}
}
$host= preg_replace ("[-a-z0-9!#$%&\'*+/=?^_`{|}~]","",$host);
$command = "tracert $host";
$fp = shell_exec("$command 2>&1");
$output .= (htmlentities(trim($fp)));
echo "<pre>$output</pre>";
echo '<br/>';
?>
...
</body>
</html>
And the html code (browser output) :
'''
<form name="tools" action="" method="post">
<p><font size="2">Your IP is </font></p>
<input type="text" name="host" value=""></input>
<input type="submit" name="trace" value="Traceroute!"></input>
</form>
<pre>Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout]
[-R] [-S srcaddr] [-4] [-6] target_name
Options:
-d Do not resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target.
-j host-list Loose source route along host-list (IPv4-only).
-w timeout Wait timeout milliseconds for each reply.
-R Trace round-trip path (IPv6-only).
-S srcaddr Source address to use (IPv6-only).
-4 Force using IPv4.
-6 Force using IPv6.</pre><br/> <script type="text/javascript">
var pinImage = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_xpin_letter_withshadow&chld=pin_star|%E2%80%A2|CC3300|000000|FF9900",
new google.maps.Size (70, 83),
new google.maps.Point (0,0),
new google.maps.Point (10,34));
var pinShadow = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
new google.maps.Size (89, 85),
new google.maps.Point (0, 0),
new google.maps.Point (12, 35));
function initialize() {
var myLatlng = new google.maps.LatLng(38.822591, 150.46875);
var myOptions = {
zoom: 2,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
...
All I need is to hide the help usage of traceroute like in my html code. So when I first load the page, it just show the text field, button and map without that usage of tracert. I really need your help as soon as possible. Big thanks.