Created
June 1, 2015 15:28
-
-
Save markbalt/ad9d320c49b371c123aa to your computer and use it in GitHub Desktop.
Log IP Keys (Symfony)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); | |
foreach ($ip_keys as $key) { | |
foreach (explode(',', $_SERVER[$key]) as $ip) { | |
$ip = trim($ip); | |
sfContext::getInstance()->getLogger()->err(sprintf('%s %s', $key, $ip)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment