\n";
} else {
fputs ($fp, $HTTP_POST_VARS['T1']."\r\n");
while (!feof($fp)) {
$tmp_reply = fgets ($fp,128);
$tmp_reply = str_replace("\r", "", $tmp_reply);
$tmp_reply = str_replace("\n", "
\n", $tmp_reply);
$tmp_reply = str_replace(" ", " ", $tmp_reply);
if (substr($reply, 0, 1) == " ") {
$tmp_reply = substr_replace($tmp_reply, " ", 0, 1);
}
$reply .= $tmp_reply;
}
fclose ($fp);
$reply = "Whois server ".$HTTP_POST_VARS['D1']. " responded with the following for ".$HTTP_POST_VARS['T1'].": -
\n".$reply;
}
}
}
if ($HTTP_POST_VARS['B1'] == "IP Lookup") {
if ($HTTP_POST_VARS['T1'] == "") {
$msg = "You didn't supply a host name the previous page.";
} else {
$error = False;
$reply = "The IP address for ".$HTTP_POST_VARS['T1']." is: -
".gethostbyname($HTTP_POST_VARS['T1']);
}
}
if ($HTTP_POST_VARS['B1'] == "Host Name Lookup") {
if ($HTTP_POST_VARS['T1'] == "") {
$msg = "You didn't supply an IP address the previous page.";
} else {
$error = False;
$reply = "The host name for ".$HTTP_POST_VARS['T1']." is: -
".gethostbyaddr($HTTP_POST_VARS['T1']);
}
}
if ($error) {
echo "".$msg."
\n";
echo "Click here to return to the previous page or click the Back button on your browser.
\n";
} else {
echo "".$reply."
\n";
}
?>