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>
28 lines
599 B
PHP
28 lines
599 B
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()
|
|
);
|
|
if (isset($_GET['nice'])) {
|
|
?><!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<style>
|
|
body {
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body><?php
|
|
echo implode("<br><br>",$data);
|
|
?></body>
|
|
</html><?php
|
|
} else {
|
|
echo implode("\n",$data);
|
|
}
|
|
?>
|