Defeat Posted November 27, 2011 Share Posted November 27, 2011 How do I need to do that, I've tried some before, but for some reason it didn't work. I've lost my code-.- so I can't show it... It was something with: $_SERVER['REMOTE_ADDR'] but when I echo'd it, it would only show::1 which is probably from 127.0.0.1, I guess? Would this still work if I stored this in a table when someone else is visithing the site. Thank you:) Quote Link to comment https://forums.phpfreaks.com/topic/251882-get-visitors-ip-store-it/ Share on other sites More sharing options...
QuickOldCar Posted November 27, 2011 Share Posted November 27, 2011 $_SERVER['REMOTE_ADDR'] should get the visiting ip address Quote Link to comment https://forums.phpfreaks.com/topic/251882-get-visitors-ip-store-it/#findComment-1291551 Share on other sites More sharing options...
floridaflatlander Posted November 27, 2011 Share Posted November 27, 2011 that'a what i use ad on my localhost i get 127.0.0.1 Quote Link to comment https://forums.phpfreaks.com/topic/251882-get-visitors-ip-store-it/#findComment-1291553 Share on other sites More sharing options...
fenway Posted November 27, 2011 Share Posted November 27, 2011 that'a what i use ad on my localhost i get 127.0.0.1 So why not test it on a live site? Quote Link to comment https://forums.phpfreaks.com/topic/251882-get-visitors-ip-store-it/#findComment-1291567 Share on other sites More sharing options...
The Little Guy Posted November 29, 2011 Share Posted November 29, 2011 ::1 is the IPv6 equivalent of IPv4 127.0.0.1 address. You can convert IPv6 address to IPv4 address using function inet_ntop() http://php.net/manual/en/function.inet-ntop.php Quote Link to comment https://forums.phpfreaks.com/topic/251882-get-visitors-ip-store-it/#findComment-1292387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.