Files
ipecho/legacy/i.zk.gd-index.php
zzgandClaude Opus 5.5 506bc20652 ipecho: Go replacement for i.z.gd/i.zk.gd PHP pages
Serves the same fields and formats as the old PHP scripts, with
HTML/XML/CSV output escaped, X-Real-IP trusted only from loopback,
and a 2s reverse-DNS timeout. m.z.gd becomes an nginx return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:05:06 -07:00

35 lines
1.0 KiB
PHP

<?php
$data = array (
'ip' => $_SERVER['REMOTE_ADDR'],
'hostname' => gethostbyaddr($_SERVER['REMOTE_ADDR']),
'user-agent' => (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''),
'timestamp' => time()
);
$output = (isset($_GET['output']) ? $_GET['output'] : '');
switch($output)
{
case 'xml':
header("Content-Type: text/xml");
echo '<?xml version="1.0"?>'."\n";
echo '<info>'."\n";
foreach($data as $key => $value)
echo "\t".'<'.$key.'>'.$value.'</'.$key.'>'."\n";
echo '</info>';
break;
case 'json':
header("Content-Type: application/json");
echo json_encode($data);
break;
case 'csv':
header("Content-Type: text/csv");
echo implode(',',$data);
break;
case 'txt':
default:
header("Content-Type: text/plain");
echo implode("\n",$data);
break;
}