Files
wsinfra-IT/index.php
2026-03-30 11:51:52 +02:00

24 lines
762 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
$ip = defined('CURRENT_IP') ? CURRENT_IP : ($_SERVER['REMOTE_ADDR'] ?? '');
$s = $ip; // fallback par défaut = lIP brute
if ($ip && filter_var($ip, FILTER_VALIDATE_IP)) {
try {
$h = @gethostbyaddr($ip); // @ pour éviter le warning DNS
if ($h && $h !== $ip) {
$s = explode('.', $h)[0]; // court hostname
}
} catch (ValueError $e) {
// IP invalide → on garde $s = $ip
}
} elseif (!$ip) {
$s = 'UNKNOWN_IP';
}
$u = CURRENT_USER ?? "Anonymous";
echo "Hello $u <br>";
echo "Having fun navigating from $s ? <br>";
echo "Nothing to see in here ;) <br>";
echo "<b>Every action is logged !</b> <br>";
?>