54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
$config = include('config.php');
|
|
|
|
// Define method by get parameter
|
|
if(empty($_GET)) {
|
|
$method = "simple";
|
|
} else {
|
|
$method = $_GET['m'];
|
|
}
|
|
|
|
if($method === "simple") { // simple
|
|
echo $_SERVER['REMOTE_ADDR'] . "\n";
|
|
} elseif($method === "detailed" ) { // detailed
|
|
readheader("REMOTE_ADDR");
|
|
readheader("HTTP_X_FORWARDED_FOR");
|
|
readheader("HTTP_USER_AGENT");
|
|
readheader("HTTP_CLIENT_IP");
|
|
readheader("HTTP_X_FORWARDED");
|
|
readheader("HTTP_FORWARDED_FOR");
|
|
readheader("HTTP_FORWARDED");
|
|
readheader("HTTP_HOST");
|
|
readheader("HTTP_URI");
|
|
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
|
|
echo "<br />";
|
|
echo "<strong>HOSTNAME</strong>: " . $hostname;
|
|
echo "<br />";
|
|
echo "<strong>IPv4 REVERSE LOOKUP</strong>: " . implode(', ', gethostbynamel($hostname));
|
|
echo "<br /><br /><strong>WHOIS:</strong>";
|
|
$whois = shell_exec("whois " . $_SERVER['REMOTE_ADDR']);
|
|
echo "<pre>"; print_r($whois); echo "</pre>";
|
|
echo "<br />";
|
|
|
|
echo "<br /><hr /><br />";
|
|
echo 'Plain IP address: <a href="//'.$config->ip4domain.'">IPv4</a> | <a href="//'.$config->ip6domain.'">IPv6</a>';
|
|
echo "<br />";
|
|
echo 'Detailed header info: <a href="//'.$config->ip4domain.'/'.$config->detailed_uri.'">IPv4</a> | <a href="//'.$config->ip6domain.'/'.$config->detailed_uri.'">IPv6</a>';
|
|
} else { // wrong URL
|
|
header("HTTP/1.1 301 Moved Permanently");
|
|
header("Location:/".$config->detailed_uri."");
|
|
exit;
|
|
}
|
|
|
|
function readheader($value)
|
|
{
|
|
echo "<strong>" . $value . "</strong>: "; // show desired value
|
|
if(isset($_SERVER[$value])) { // only if desired header has been delivered
|
|
echo $_SERVER[$value];
|
|
}
|
|
echo "<br />";
|
|
}
|
|
|
|
?>
|