Welcome Guest, Not a member yet? Register   Sign In
Questions About IP Addresses
#1

Hi! 

I want to know the real IP address of the client accessing my app.  Why?
So I can compare it with my IP address.
I'm working on a web based desk top app and I do not want an employees logging in from anywhere other than physically in my office; unless an admin. 

None of these below returns anything useful from behind LOCALHOST, it returns my own IP address as ::1  
Will I get a better result on a public host?  Is there a PHP.ini setting that I need to make?
Perhaps you have a better approach.... 
PHP Code:
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
 
  //ip from share internet
 
   $ip $_SERVER['HTTP_CLIENT_IP'];
}
elseif(!empty(
$_SERVER['HTTP_X_FORWARDED_FOR'])){
 
  //ip pass from proxy
 
   $ip $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else{
 
   $ip $_SERVER['REMOTE_ADDR'];

Thanks for any insights.
Reply


Messages In This Thread
Questions About IP Addresses - by CobolGuy - 05-13-2018, 07:45 PM
RE: Questions About IP Addresses - by skunkbad - 05-13-2018, 08:13 PM
RE: Questions About IP Addresses - by Krycek - 05-13-2018, 11:56 PM
RE: Questions About IP Addresses - by InsiteFX - 05-14-2018, 04:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB