Skip to content

Instantly share code, notes, and snippets.

@fedek6

fedek6/phpinfo.php

Created Sep 28, 2015
Embed
What would you like to do?
phpinfo() only for local requests
<?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