Import source

This commit is contained in:
Steffen Lange 2019-04-05 18:55:31 +02:00
parent b397f4ab19
commit cbccd71059
2 changed files with 28 additions and 0 deletions

20
echoip.php Normal file
View file

@ -0,0 +1,20 @@
<?php
ini_set('default_charset', 'iso-8859-1');
header('Content-Type: text/plain');
$ip = $_SERVER['REMOTE_ADDR'];
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$cmd = isset($_GET['cmd']) ? $_GET['cmd'] : '';
if ($cmd === 'long') {
printf('%u', ip2long($ip));
}
elseif ($cmd === 'hostname') {
echo gethostbyaddr($ip);
}
else {
echo $ip;
}
}
else {
echo $ip;
}
?>