本文整理汇总了PHP中MAX_cookieFlush函数的典型用法代码示例。如果您正苦于以下问题:PHP MAX_cookieFlush函数的具体用法?PHP MAX_cookieFlush怎么用?PHP MAX_cookieFlush使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAX_cookieFlush函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MAX_cookieSetViewerIdAndRedirect
/**
* This function sets the viewerid cookie, and does a header redirect to self
* this lets us tell if a user allows permenant cookies to be set
*
* @param string $viewerId The viewerId value to attempt to set
*/
function MAX_cookieSetViewerIdAndRedirect($viewerId)
{
$aConf = $GLOBALS['_MAX']['CONF'];
MAX_cookieAdd($aConf['var']['viewerId'], $viewerId, _getTimeYearFromNow());
MAX_cookieFlush();
// Determine if the access to OpenX was made using HTTPS
if ($GLOBALS['_MAX']['SSL_REQUEST']) {
$url = MAX_commonConstructSecureDeliveryUrl(basename($_SERVER['SCRIPT_NAME']));
} else {
$url = MAX_commonConstructDeliveryUrl(basename($_SERVER['SCRIPT_NAME']));
}
$url .= "?{$aConf['var']['cookieTest']}=1&" . $_SERVER['QUERY_STRING'];
MAX_header("Location: {$url}");
###START_STRIP_DELIVERY
if (empty($GLOBALS['is_simulation']) && !defined('TEST_ENVIRONMENT_RUNNING')) {
###END_STRIP_DELIVERY
exit;
###START_STRIP_DELIVERY
}
###END_STRIP_DELIVERY
}
示例2: view_local
function view_local($what, $zoneid = 0, $campaignid = 0, $bannerid = 0, $target = '', $source = '', $withtext = '', $context = '', $charset = '')
{
// start stacked output buffering
ob_start();
if (empty($what) && !(strstr($what, 'zone') or strstr($what, 'campaign') or strstr($what, 'banner'))) {
if ($zoneid) {
$what = "zone:" . $zoneid;
}
if ($campaignid) {
$what = "campaignid:" . $campaignid;
}
if ($bannerid) {
$what = "bannerid:" . $bannerid;
}
}
$output = MAX_adSelect($what, $campaignid, $target, $source, $withtext, $charset, $context, true, '', $GLOBALS['loc'], $GLOBALS['referer']);
if (isset($output['contenttype']) && $output['contenttype'] == 'swf') {
$output['html'] = MAX_flashGetFlashObjectExternal() . $output['html'];
}
// Add any $context information to the global phpAds_context array
if (isset($GLOBALS['phpAds_context']) && is_array($GLOBALS['phpAds_context']) && isset($output['context']) && is_array($output['context'])) {
// Check if the new context item is already in the global array, and add it if not
foreach ($GLOBALS['phpAds_context'] as $idx => $item) {
foreach ($output['context'] as $newidx => $newItem) {
if ($newItem === $item) {
unset($output['context'][$newidx]);
}
}
}
$GLOBALS['phpAds_context'] = $GLOBALS['phpAds_context'] + $output['context'];
}
MAX_cookieFlush();
// add cookies to output html
$output['html'] .= ob_get_clean();
return $output;
}
示例3: MAX_cookieSetViewerIdAndRedirect
function MAX_cookieSetViewerIdAndRedirect($viewerId)
{
$aConf = $GLOBALS['_MAX']['CONF'];
MAX_cookieAdd($aConf['var']['viewerId'], $viewerId, _getTimeYearFromNow());
MAX_cookieFlush();
if ($GLOBALS['_MAX']['SSL_REQUEST']) {
$url = MAX_commonConstructSecureDeliveryUrl(basename($_SERVER['SCRIPT_NAME']));
} else {
$url = MAX_commonConstructDeliveryUrl(basename($_SERVER['SCRIPT_NAME']));
}
$url .= "?{$aConf['var']['cookieTest']}=1&" . $_SERVER['QUERY_STRING'];
MAX_header("Location: {$url}");
exit;
}
示例4: MAX_cookieSetViewerIdAndRedirect
function MAX_cookieSetViewerIdAndRedirect($viewerId)
{
$aConf = $GLOBALS['_MAX']['CONF'];
MAX_cookieAdd($aConf['var']['viewerId'], $viewerId, _getTimeYearFromNow());
MAX_cookieFlush();
// Determine if the access to OpenX was made using HTTPS
if ($_SERVER['SERVER_PORT'] == $aConf['openads']['sslPort']) {
$url = MAX_commonConstructSecureDeliveryUrl(basename($_SERVER['PHP_SELF']));
} else {
$url = MAX_commonConstructDeliveryUrl(basename($_SERVER['PHP_SELF']));
}
$url .= "?{$aConf['var']['cookieTest']}=1&" . $_SERVER['QUERY_STRING'];
MAX_header("Location: {$url}");
exit;
}
示例5: OA_Delivery_XmlRpc_SPC
//.........这里部分代码省略.........
for ($i = 0; $i < $numParams; $i++) {
$p = $params->getParam($i);
if ($i) {
// Put the decoded value the view arg array
${$vars}[$i] = XML_RPC_decode($p);
} else {
// First parameter: environment information supplied be XML-RPC client
$p = XML_RPC_decode($p);
if (!isset($p['remote_addr'])) {
// Return an error
$errorCode = $XML_RPC_erruser + 22;
$errorMsg = "Missing 'remote_addr' member";
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
if (!isset($p['cookies']) || !is_array($p['cookies'])) {
// Return an error
$errorCode = $XML_RPC_erruser + 23;
$errorMsg = "Missing 'cookies' member";
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
$aServerVars = array('remote_addr' => 'REMOTE_ADDR', 'remote_host' => 'REMOTE_HOST', 'request_uri' => 'REQUEST_URI', 'https' => 'HTTPS', 'server_name' => 'SERVER_NAME', 'http_host' => 'HTTP_HOST', 'accept_language' => 'HTTP_ACCEPT_LANGUAGE', 'referer' => 'HTTP_REFERER', 'user_agent' => 'HTTP_USER_AGENT', 'via' => 'HTTP_VIA', 'forwarded' => 'HTTP_FORWARDED', 'forwarded_for' => 'HTTP_FORWARDED_FOR', 'x_forwarded' => 'HTTP_X_FORWARDED', 'x_forwarded_for' => 'HTTP_X_FORWARDED_FOR', 'client_ip' => 'HTTP_CLIENT_IP');
// Extract environment vars to $_SERVER
foreach ($aServerVars as $xmlName => $varName) {
if (isset($p[$xmlName])) {
$_SERVER[$varName] = $p[$xmlName];
}
}
// Extract cookie vars to $_COOKIE
foreach ($p['cookies'] as $key => $value) {
$_COOKIE[$key] = MAX_commonAddslashesRecursive($value);
}
MAX_cookieUnpackCapping();
}
}
// Add defaults for not-applicable values
$richmedia = true;
$ct0 = '';
$context = array();
// Make loc and referer global to ensure that the delivery limitations work correctly
global $loc, $referer;
$loc = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . OX_getHostName() . $_SERVER['REQUEST_URI'];
// Add $referer parameter
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
// If the what parameter is an int, it is the affiliateid, otherwise it's a serialized array of name=zone pairs
// This convention is inline with the parameters passed into local-mode SPC
if (is_numeric($what)) {
$zones = OA_cacheGetPublisherZones($what);
$nz = false;
} else {
$zones = unserialize($what);
$nz = true;
}
$spc_output = array();
foreach ($zones as $zone => $data) {
if (empty($zone)) {
continue;
}
// nz is set when "named zones" are being used, this allows a zone to be selected more than once
if ($nz) {
$varname = $zone;
$zoneid = $data;
} else {
$varname = $zoneid = $zone;
}
// Get the banner
$output = MAX_adSelect('zone:' . $zoneid, '', $target, $source, $withtext, '', $context, $richmedia, $ct0, $GLOBALS['loc'], $GLOBALS['referer']);
$spc_output[$varname] = $output;
// Block this banner for next invocation
if (!empty($block) && !empty($output['bannerid'])) {
$output['context'][] = array('!=' => 'bannerid:' . $output['bannerid']);
}
// Block this campaign for next invocation
if (!empty($blockcampaign) && !empty($output['campaignid'])) {
$output['context'][] = array('!=' => 'campaignid:' . $output['campaignid']);
}
// Pass the context array back to the next call, have to iterate over elements to prevent duplication
if (!empty($output['context'])) {
foreach ($output['context'] as $id => $contextArray) {
if (!in_array($contextArray, $context)) {
$context[] = $contextArray;
}
}
}
}
return new XML_RPC_Response(XML_RPC_encode($spc_output));
// Now we have all the parameters we need to select the ad
// Call MAX_adSelect with supplied parameters
$output = call_user_func_array('MAX_adSelect', $view_params);
// Prepare output as PHP array
if (!is_array($output)) {
$output = array();
} elseif (isset($output['contenttype']) && $output['contenttype'] == 'swf') {
$output['html'] = MAX_flashGetFlashObjectExternal() . $output['html'];
}
MAX_cookieFlush();
// Add cookie information
$output['cookies'] = $GLOBALS['_OA']['COOKIE']['XMLRPC_CACHE'];
// Return response
return new XML_RPC_Response(XML_RPC_encode($output));
}
示例6: phpAds_SessionDataDestroy
/**
* Destroy the current session
*
* @todo Determine how much of these steps are unnecessary, and remove them.
*/
function phpAds_SessionDataDestroy()
{
$dal = new MAX_Dal_Admin_Session();
global $session;
$dal->deleteSession($_COOKIE['sessionID']);
MAX_cookieAdd('sessionID', '');
MAX_cookieFlush();
unset($session);
unset($_COOKIE['sessionID']);
}
示例7: test_MAX_cookieFlush
function test_MAX_cookieFlush()
{
$conf =& $GLOBALS['_MAX']['CONF'];
// The cookieFluch function requires variables which are initialised in common.php
MAX_commonInitVariables();
// Test that a very long cookie is truncated to below the 2048 character limit.
$_COOKIE[$conf['var']['blockAd']] = array();
for ($i = 0; $i < 1000; $i++) {
$_COOKIE[$conf['var']['blockAd']][$i] = time();
}
$_COOKIE['_' . $conf['var']['blockAd']][$i++] = time();
MAX_cookieFlush();
$this->assertTrue(strlen($_COOKIE[$conf['var']['blockAd']]) < 2048);
}
示例8: MAX_adSelect
//OX_Delivery_logMessage('$what='.$what, 7);
//OX_Delivery_logMessage('$context='.print_r($context,true), 7);
// Get the banner
$output = MAX_adSelect($what, $clientid, $target, $source, $withtext, $charset, $context, true, $ct0, $GLOBALS['loc'], $GLOBALS['referer']);
//OX_Delivery_logMessage('$block='.@$block, 7);
//OX_Delivery_logMessage(print_r($output, true), 7);
//OX_Delivery_logMessage('output bannerid='.(empty($output['bannerid']) ? ' NO BANNERID' : $output['bannerid']), 7);
// Store the html2js'd output for this ad
$spc_output .= MAX_javascriptToHTML($output['html'], $conf['var']['prefix'] . "output['{$varname}']", false, false) . "\n";
// Block this banner for next invocation
if (!empty($block) && !empty($output['bannerid'])) {
$output['context'][] = array('!=' => 'bannerid:' . $output['bannerid']);
}
// Block this campaign for next invocation
if (!empty($blockcampaign) && !empty($output['campaignid'])) {
$output['context'][] = array('!=' => 'campaignid:' . $output['campaignid']);
}
// Pass the context array back to the next call, have to iterate over elements to prevent duplication
if (!empty($output['context'])) {
foreach ($output['context'] as $id => $contextArray) {
if (!in_array($contextArray, $context)) {
$context[] = $contextArray;
}
}
}
}
}
MAX_cookieFlush();
// Setup the banners for this page
MAX_commonSendContentTypeHeader("application/x-javascript", $charset);
echo $spc_output;
示例9: _logBeacon
/**
* merge the url params with global $_REQUEST
* call the lg.php script
*
* @param int $bannerId - if null then delivery failed
* @package string $html
*/
function _logBeacon($beaconURL)
{
if ($beaconURL) {
$requestSave = $_REQUEST;
$getSave = $_GET;
$_GET = array();
$request = MAX_querystringParseStr($beaconURL, &$aRequest, '&');
$_REQUEST = $aRequest;
chdir(MAX_PATH . '/www/delivery');
include './lg.php';
chdir(SIM_PATH);
$_REQUEST = $requestSave;
$_GET = $getSave;
} else {
MAX_cookieFlush();
}
}
示例10: OA_Delivery_XmlRpc_SPC
function OA_Delivery_XmlRpc_SPC($params)
{
global $XML_RPC_erruser;
global $XML_RPC_String, $XML_RPC_Struct, $XML_RPC_Array;
$numParams = $params->getNumParams();
if ($numParams != 7) {
$errorCode = $XML_RPC_erruser + 21;
$errorMsg = 'Incorrect number of parameters';
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
$vars = array(1 => 'what', 2 => 'target', 3 => 'source', 4 => 'withtext', 5 => 'block', 6 => 'blockcampaign');
for ($i = 0; $i < $numParams; $i++) {
$p = $params->getParam($i);
if ($i) {
${$vars}[$i] = XML_RPC_decode($p);
} else {
$p = XML_RPC_decode($p);
if (!isset($p['remote_addr'])) {
$errorCode = $XML_RPC_erruser + 22;
$errorMsg = "Missing 'remote_addr' member";
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
if (!isset($p['cookies']) || !is_array($p['cookies'])) {
$errorCode = $XML_RPC_erruser + 23;
$errorMsg = "Missing 'cookies' member";
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
$aServerVars = array('remote_addr' => 'REMOTE_ADDR', 'remote_host' => 'REMOTE_HOST', 'request_uri' => 'REQUEST_URI', 'https' => 'HTTPS', 'server_name' => 'SERVER_NAME', 'http_host' => 'HTTP_HOST', 'accept_language' => 'HTTP_ACCEPT_LANGUAGE', 'referer' => 'HTTP_REFERER', 'user_agent' => 'HTTP_USER_AGENT', 'via' => 'HTTP_VIA', 'forwarded' => 'HTTP_FORWARDED', 'forwarded_for' => 'HTTP_FORWARDED_FOR', 'x_forwarded' => 'HTTP_X_FORWARDED', 'x_forwarded_for' => 'HTTP_X_FORWARDED_FOR', 'client_ip' => 'HTTP_CLIENT_IP');
foreach ($aServerVars as $xmlName => $varName) {
if (isset($p[$xmlName])) {
$_SERVER[$varName] = $p[$xmlName];
}
}
foreach ($p['cookies'] as $key => $value) {
$_COOKIE[$key] = MAX_commonAddslashesRecursive($value);
}
MAX_remotehostSetInfo(true);
OX_Delivery_Common_hook('postInit');
MAX_cookieUnpackCapping();
}
}
$richmedia = true;
$ct0 = '';
$context = array();
global $loc, $referer;
$loc = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . OX_getHostName() . $_SERVER['REQUEST_URI'];
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if (is_numeric($what)) {
$zones = OA_cacheGetPublisherZones($what);
$nz = false;
} else {
$zones = unserialize($what);
$nz = true;
}
$spc_output = array();
foreach ($zones as $zone => $data) {
if (empty($zone)) {
continue;
}
if ($nz) {
$varname = $zone;
$zoneid = $data;
} else {
$varname = $zoneid = $zone;
}
unset($GLOBALS['_MAX']['deliveryData']);
$output = MAX_adSelect('zone:' . $zoneid, '', $target, $source, $withtext, '', $context, $richmedia, $ct0, $GLOBALS['loc'], $GLOBALS['referer']);
$spc_output[$varname] = $output;
if (!empty($block) && !empty($output['bannerid'])) {
$output['context'][] = array('!=' => 'bannerid:' . $output['bannerid']);
}
if (!empty($blockcampaign) && !empty($output['campaignid'])) {
$output['context'][] = array('!=' => 'campaignid:' . $output['campaignid']);
}
if (!empty($output['context'])) {
foreach ($output['context'] as $id => $contextArray) {
if (!in_array($contextArray, $context)) {
$context[] = $contextArray;
}
}
}
}
return new XML_RPC_Response(XML_RPC_encode($spc_output));
$output = call_user_func_array('MAX_adSelect', $view_params);
if (!is_array($output)) {
$output = array();
} elseif (isset($output['contenttype']) && $output['contenttype'] == 'swf') {
$output['html'] = MAX_flashGetFlashObjectExternal() . $output['html'];
}
MAX_cookieFlush();
$output['cookies'] = $GLOBALS['_OA']['COOKIE']['XMLRPC_CACHE'];
return new XML_RPC_Response(XML_RPC_encode($output));
}