Skip to content

Instantly share code, notes, and snippets.

@3D-I 3D-I/ipcfreal.php
Last active Jan 17, 2017

Embed
What would you like to do?
IPCF tests for 3.1/3.2 - Check wheter the host is masking IPs with HTTP_X_FORWARDED_FOR - Check CloudFlare,
<?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
You can’t perform that action at this time.