Created
September 28, 2015 09:56
-
-
Save fedek6/3fcf3742c82f8c570e0b to your computer and use it in GitHub Desktop.
phpinfo() only for local requests
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 | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { | |
$ip = $_SERVER['HTTP_CLIENT_IP']; | |
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { | |
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} else { | |
$ip = $_SERVER['REMOTE_ADDR']; | |
} | |
if ( ! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) ) | |
{ | |
phpinfo(); | |
} else { | |
echo 'In Soviet Russia server hack you!'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment