Jump to content

User IP Address


c_pattle

Recommended Posts

You can try this:

 

function getIp(){

if ( $_SERVER["HTTP_CLIENT_IP"] )                $ip = $_SERVER["HTTP_CLIENT_IP"];

else if( $_SERVER["HTTP_X_FORWARDED_FOR"] )  $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];

else if( $_SERVER["REMOTE_ADDR"] )            $ip = $_SERVER["REMOTE_ADDR"];

else                                          $ip = "UNKNOWN"; 

 

  return $ip;

}

 

Hope it helps.

Link to comment
https://forums.phpfreaks.com/topic/212354-user-ip-address/#findComment-1106433
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.