<?php
/**
* IP-Adresse bzw. Hostname anzeigen
*/
$host = '-';
$ip = '-';
$theIPS = '';
$theHOSTS = '';
$result = '';
if (isset($_POST['SEND'])) {
if( isset($_POST['IP']) && !empty($_POST['IP'])){
$host = gethostbyaddr($_POST['IP']);
$theIPS = get_magic_quotes_gpc()? stripslashes($_POST['IP']):$_POST['IP'];
}
if( isset($_POST['HOST']) AND !empty($_POST['HOST']) ){
$ip = gethostbyname($_POST['HOST']);
$theHOSTS = get_magic_quotes_gpc()? stripslashes($_POST['HOST']):$_POST['HOST'];
}
}
$my_ip = $_SERVER['REMOTE_ADDR'];
$my_host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo<<<EOT
<form action="{$_SERVER['PHP_SELF']}" method="post">
<table>
<tr>
<th>IP</th><th>HOST</th>
</tr>
<tr>
<td><input type="text" name="IP" value="{$theIPS}"></td>
<td><h4>{$host}</h4></td>
</tr>
<tr>
<td><h4>{$ip}</h4></td>
<td><input type="text" name="HOST" value="{$theHOSTS}"></td>
</tr>
<tr>
<td><input type="hidden" name="SEND" value="true"><input type="submit"></td>
</tr>
</table>
</form>
<h4>My-IP is $my_ip</h4>
<h4>My-HOST is $my_host</h4>
EOT;
?>