Skip to content

Instantly share code, notes, and snippets.

@lmeyer
Created November 21, 2012 16:26
Show Gist options
  • Save lmeyer/4125841 to your computer and use it in GitHub Desktop.
Save lmeyer/4125841 to your computer and use it in GitHub Desktop.
Detect user IP throught load balancer
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
$hostname=$_SERVER["HTTP_X_FORWARDED_FOR"] . ' via ' . $_SERVER["REMOTE_ADDR"];
$hostname=$_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
$hostname=$_SERVER["REMOTE_ADDR"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment