Good Day
I was asked to make a website using php that tells the user their IP address. If the X_FORWARDED_FOR header is being used, it is meant to look there for the IP.
I'm probably making a simple mistake, but I really can't find whats wrong, and this is my first time actually programming in php. The page doesn't show anything from my php code for some reason, but gives no errors.
Here's the code:
<?php
$ip=@$REMOTE_ADDR;//actual ip if no proxy used
$real_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];//actual ip if proxy used
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER))
echo $real_ip;
else
echo $ip;
?>
Any help would be greatly apperciated, thanks