Last active
January 17, 2017 00:10
-
-
Save 3D-I/9419c2d2916ecfffc56950a4337be459 to your computer and use it in GitHub Desktop.
IPCF tests for 3.1/3.2 - Check wheter the host is masking IPs with HTTP_X_FORWARDED_FOR - Check CloudFlare,
This file contains hidden or 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 | |
/** | |
* Usage: Download and unzip the file, upload/save it to your Board's root | |
* (i.e.: www.mydomain.com/phpBB3/ipcfreal.php) | |
* Point your browser to i.e.: www.mydomain.com/phpBB3/ipcfipreal.php - results will be on your screen | |
* @package - IPCF tests / IP Real | |
* @copyright (c) 2016, 2017 3Di | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 | |
*/ | |
define('IN_PHPBB', true); | |
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; | |
$phpEx = substr(strrchr(__FILE__, '.'), 1); | |
include($phpbb_root_path . 'common.' . $phpEx); | |
// Start session management | |
$user->session_begin(); | |
$auth->acl($user->data); | |
echo 'Server Name: ' . htmlspecialchars_decode($request->server('SERVER_NAME')) . '<br />'; | |
echo 'Server IP: ' . htmlspecialchars_decode($request->server('SERVER_ADDR')) . '<br />'; | |
echo 'Your IP: ' . htmlspecialchars_decode($request->server('REMOTE_ADDR')) . '<br />'; | |
/* Check wheter the host is masking IPs with HTTP_X_FORWARDED_FOR */ | |
if ($request->server('HTTP_X_FORWARDED_FOR' != '')) | |
{ | |
echo '<br />Forwarded For: ' . htmlspecialchars_decode($request->server('HTTP_X_FORWARDED_FOR')); | |
} | |
else | |
{ | |
echo '<br />The host is not masking IPs with HTTP_X_FORWARDED_FOR <br />'; | |
} | |
/* Is Cloudflare? */ | |
if ($request->server('HTTP_CF_CONNECTING_IP') != '') | |
{ | |
echo '<br />IP by CloudFlare: ' . htmlspecialchars_decode($request->server('HTTP_CF_CONNECTING_IP')); | |
} | |
else | |
{ | |
echo '<br />No CloudFlare, real IP: ' . htmlspecialchars_decode($request->server('REMOTE_ADDR')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment