本文整理汇总了PHP中MAX_remotehostProxyLookup函数的典型用法代码示例。如果您正苦于以下问题:PHP MAX_remotehostProxyLookup函数的具体用法?PHP MAX_remotehostProxyLookup怎么用?PHP MAX_remotehostProxyLookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAX_remotehostProxyLookup函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MAX_remotehostSetInfo
/**
* Wrapper function to set all remotehost information, by default this will execute if the invocationType is
* not set to "xml-rpc" (xml-rpc calls this after re-populating the $_SERVER array)
*
* @param boolean $run Ignore invocationType checking?
*/
function MAX_remotehostSetInfo($run = false)
{
if (empty($GLOBALS['_OA']['invocationType']) || $run || $GLOBALS['_OA']['invocationType'] != 'xmlrpc') {
MAX_remotehostProxyLookup();
MAX_remotehostReverseLookup();
//MAX_remotehostSetClientInfo(); // now moved into plugin
MAX_remotehostSetGeoInfo();
}
}
示例2: test_MAX_remotehostProxyLookup
/**
* @todo future test case
* A function to convert the $_SERVER['REMOTE_ADDR'] global variable
* from the current value to the real remote viewer's value, should
* that viewer be coming via an HTTP proxy.
*
* Only performs this conversion if the option to do so is set in the
* configuration file.
*/
function test_MAX_remotehostProxyLookup()
{
$serverSave = $_SERVER;
// This $_SERVER dump was provided by a user running HAProxy
$sampleSERVER = array('HTTP_HOST' => 'max.i12.de', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.5) Gecko/20070718 Fedora/2.0.0.5-1.fc7 Firefox/2.0.0.5', 'HTTP_ACCEPT' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_LANGUAGE' => 'en-gb,en;q=0.5', 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_KEEP_ALIVE' => '300', 'HTTP_COOKIE' => 'phpAds_id=abcdef1234567890acdef1234567890a', 'HTTP_CONNECTION' => 'close', 'PATH' => '/usr/bin:/bin:/usr/sbin:/sbin', 'SERVER_SIGNATURE' => '<address>Apache/2.0.59 (Unix) Server at max.i12.de Port 80</address>', 'SERVER_SOFTWARE' => 'Apache/2.0.59 (Unix)', 'SERVER_NAME' => 'dev.openx.org', 'SERVER_ADDR' => '10.0.0.1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '10.0.0.2', 'DOCUMENT_ROOT' => '/var/www/html/live-openads', 'SERVER_ADMIN' => 'bugs@openads.org', 'SCRIPT_FILENAME' => '/var/www/html/live-openads/lib/max/Delivery/tests/unit/remotehost.del.test.php', 'REMOTE_PORT' => '49083', 'GEOIP_CONTINENT_CODE' => '--', 'GEOIP_COUNTRY_CODE' => '--', 'GEOIP_COUNTRY_NAME' => 'N/A', 'GEOIP_DMA_CODE' => '0', 'GEOIP_AREA_CODE' => '0', 'GEOIP_LATITUDE' => '0.000000', 'GEOIP_LONGITUDE' => '0.000000', 'GEOIP_ISP' => 'Nildram', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/lib/max/Delivery/tests/unit/remotehost.del.test.php', 'SCRIPT_NAME' => '/lib/max/Delivery/tests/unit/remotehost.del.test.php', 'PHP_SELF' => '/lib/max/Delivery/tests/unit/remotehost.del.test.php', 'REQUEST_TIME' => time());
// I am unsure if this is a bug in OpenX or HAProxy, but the above dump does not contain
// either an HTTP_VIA/REMOTE_HOST header, therefore OpenX assumes this is not proxied
// I am adding it to "fix" the test
$GLOBALS['_MAX']['CONF']['logging']['proxyLookup'] = true;
// Check if just HTTP_VIA in the above array:
$_SERVER = $sampleSERVER;
$_SERVER['HTTP_VIA'] = '194.85.1.1 (Squid/2.4.STABLE7)';
$_SERVER['HTTP_FORWARDED_FOR'] = '124.124.124.124';
$return = MAX_remotehostProxyLookup();
$this->assertTrue($_SERVER['REMOTE_ADDR'] == $_SERVER['HTTP_FORWARDED_FOR']);
// Test with 'HTTP_X_FORWARDED_FOR' instead of via
$_SERVER = $sampleSERVER;
$_SERVER['HTTP_X_FORWARDED_FOR'] = '125.125.125.125';
$return = MAX_remotehostProxyLookup();
$this->assertTrue($_SERVER['REMOTE_ADDR'] == $_SERVER['HTTP_X_FORWARDED_FOR']);
// Check that if neither are set, then the remotehost lookup entry is performed
$_SERVER = $sampleSERVER;
$_SERVER['REMOTE_HOST'] = 'my.proxy.com';
$_SERVER['HTTP_CLIENT_IP'] = '126.126.126.126';
$return = MAX_remotehostProxyLookup();
$this->assertTrue($_SERVER['REMOTE_ADDR'] == $_SERVER['HTTP_CLIENT_IP']);
// Check that with multiple X_FORWARDED_FOR entries, the leftmost value is used
$_SERVER = $sampleSERVER;
$_SERVER['HTTP_X_FORWARDED_FOR'] = '111.111.111.111, 222.222.222.222';
$return = MAX_remotehostProxyLookup();
$this->assertTrue($_SERVER['REMOTE_ADDR'] == '111.111.111.111');
// Check that with multiple X_FORWARDED_FOR entries, the leftmost NON-PRIVATE value is used
$_SERVER = $sampleSERVER;
$_SERVER['HTTP_X_FORWARDED_FOR'] = '10.10.10.10, 111.111.111.111, 222.222.222.222';
$return = MAX_remotehostProxyLookup();
$this->assertTrue($_SERVER['REMOTE_ADDR'] == '111.111.111.111');
// Check that with multiple X_FORWARDED_FOR entries, the leftmost NON-PRIVATE value is used
$_SERVER = $sampleSERVER;
$_SERVER['HTTP_X_FORWARDED_FOR'] = '10.10.10.10, 192.168.1.1, 111.111.111.111, 222.222.222.222';
$return = MAX_remotehostProxyLookup();
$this->assertTrue($_SERVER['REMOTE_ADDR'] == '111.111.111.111');
$_SERVER = $serverSave;
}
示例3: MAX_remotehostProxyLookup
| http://www.revive-adserver.com |
| |
| Copyright: See the COPYRIGHT.txt file. |
| License: GPLv2 or later, see the LICENSE.txt file. |
+---------------------------------------------------------------------------+
*/
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/lib-banner.inc.php';
require_once LIB_PATH . '/Plugin/Component.php';
require_once MAX_PATH . '/lib/max/Dal/Admin/Acls.php';
if (!isset($GLOBALS['_MAX']['FILES']['/lib/max/Delivery/remotehost.php'])) {
// Required by PHP5.1.2
require_once MAX_PATH . '/lib/max/Delivery/remotehost.php';
}
// Initialize the client info to enable client targeting options
MAX_remotehostProxyLookup();
MAX_remotehostReverseLookup();
//MAX_remotehostSetClientInfo(); // moved to plugin
MAX_remotehostSetGeoInfo();
/**
* @todo I believe the following is unnecessary with the "MAX_remotehostSetGeoInfo()" above
* However the isAllowed() methods for the Geo-Plugins will have to be updated
*/
// Register the geotargeting information if necessary
if (!isset($GLOBALS['_MAX']['GEO_DATA']) && (!empty($conf['geotargeting']['type']) && $conf['geotargeting']['type'] != 'none')) {
$oGeoComponent = OX_Component::factoryByComponentIdentifier($conf['geotargeting']['type']);
// Get geotargeting info
if ($oGeoComponent) {
// Set the geotargeting IP to the fixed test address
// (IP Address used to determine which (if any) MaxMind databases are installed)
$GLOBALS['_MAX']['GEO_IP'] = '24.24.24.24';