I am new in computer science and also on this site. I am using php *5.4.** on localhost server and trying to get user ip address something like this
$ipaddress = $_SERVER['REMOTE_ADDR'];
echo 'Your IP address (using $_SERVER[\'REMOTE_ADDR\']) is ' . $ipaddress . '<br />';
In output comes something like this:
Your IP address (using $_SERVER['REMOTE_ADDR']) is ::1
if possible give me please secure method to get ip address and prevent any type of attacks with ip address