Web-based MTR Script

Few days ago I helped my friend to write a web-based MTR, and here is the script:

<form action="index.php" method="get">
Address <input type=text name=address /> Counter <input type=text name=counter size=4 value=15> <input type=submit value=go />


if (strlen($_GET[address]) > 0
&amp;&amp;  $_GET[address] != 'localhost'
&amp;&amp; $_GET[address] != ''
&amp;&amp; $_GET[address] != ''
&amp;&amp; $_GET[counter] <= 50) {
$output = shell_exec('mtr '.$_GET[address].' -r -c '.$_GET[counter]);
echo "<pre>$output</pre>";


The script will execute shell command similar to:

$ mtr <host> -r -c <counter>

One thought on “Web-based MTR Script

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.