Welcome Guest, Not a member yet? Register   Sign In
Remote IP and Local IP in code igniter
#1

[eluser]Unknown[/eluser]
Hello everybody,

I am newbee for CodeIgniter and I would need your support and help for one of my problem.

My problem is,

I would like to catch clients local ip and their remote ip.
eg. If my user is inside a corporate LAN network, user would have to definitely use any proxy (either squid or any other). Now I would like to catch their global IP and their local proxy or client IP thru CodeIgniter.

Any help is much appreciated.

Thanks
#2

[eluser]InsiteFX[/eluser]
To Extract the users gateway IP address:
Code:
$ip = $_SERVER['REMOTE_ADDR'];

To obtain the hostname of the gateway IP address:
Code:
$hostname = GetHostByName($_SERVER['REMOTE_ADDR']);

To get the users local IP address:
Code:
$localip = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];

Make sure you clean all input data...

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB