initial commit
This commit is contained in:
24
index.php
Normal file
24
index.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
|
||||
$ip = defined('CURRENT_IP') ? CURRENT_IP : ($_SERVER['REMOTE_ADDR'] ?? '');
|
||||
$s = $ip; // fallback par défaut = l’IP 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>";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user