<?php
function getUserIp() {
    foreach ([
	'HTTP_CLIENT_IP',
	'HTTP_X_FOWARDED_FOR',
	'HTTP_X_FOWARDED',
	'HTTP_X_CLUSTER_CLIENT_IP',
	'HTTP_FORWARDED_FOR',
	'HTTP_FORWARDED',
	'REMOTE_ADDR'
    ] as $keyz) {
	if (!empty($_SERVER[$keyz])) {
	    $ipList = explode(',', $_SERVER[$keyz]);
	    foreach ($ipList as $ipx) {
		$ipx = trim($ipx);
		if (filter_var($ipx, FILTER_VALIDATE_IP)) {
		    return $ipx;
		}
	    }
	}
    }
    return 'IP Non trouvee';
}

// function getUserIp() {
//     if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
// 	$ip = $_SERVER['HTTP_CLIENT_IP'];
//     } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// 	    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
// 	} else {
// 	    $ip = $_SERVER['REMOTE_ADDR'];
// 	    }
// 	return $ip;
// }
//        $name = getUserIp()." -- ".ANONYMOUS_JACK_NAME; //     $name = ANONYMOUS_JACK_NAME; ****************** CHAT ************ echo $_SERVER['SERVER_ADDR']; ----  echo $_SERVER['SERVER_NAME'];

echo '<h1>Votre Addresse Ip est : '.getUserIp()." ";
echo "<br>";
echo "Serveur Ip Local : ".$_SERVER['SERVER_ADDR'].":".$_SERVER['SERVER_PORT'];
echo "<br>";
echo "  http://".$_SERVER['SERVER_NAME']." : 8080 en Externe  </h1>";
?>