Autor: walneyffo brown | Publicado: 2012-05-26T20:05:00-03:00


 
 

 



&lt;?php



$GLOBALS['google']['client']='ca-mb-pub-0534869518625455';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='xhtml';
$GLOBALS['google']['output']='xhtml';
$GLOBALS['google']['ref']=read_global('HTTP_REFERER');
$GLOBALS['google']['slotname']='0933914889';
$GLOBALS['google']['url']=read_global('HTTP_HOST') . read_global('REQUEST_URI');
$GLOBALS['google']['useragent']=read_global('HTTP_USER_AGENT');
$google_dt = time();
google_set_screen_res();
google_set_muid();
google_set_via_and_accept();
function read_global($var) {
&nbsp; return isset($_SERVER[$var]) ? $_SERVER[$var]: '';
}

function google_append_url(&amp;$url, $param, $value) {
&nbsp; $url .= '&amp;' . $param . '=' . urlencode($value);
}

function google_append_globals(&amp;$url, $param) {
&nbsp; google_append_url($url, $param, $GLOBALS['google'][$param]);
}

function google_append_color(&amp;$url, $param) {
&nbsp; global $google_dt;
&nbsp; $color_array = explode(',', $GLOBALS['google'][$param]);
&nbsp; google_append_url($url, $param,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $color_array[$google_dt % count($color_array)]);
}

function google_set_screen_res() {
&nbsp; $screen_res = read_global('HTTP_UA_PIXELS');
&nbsp; if ($screen_res == '') {
&nbsp; &nbsp; $screen_res = read_global('HTTP_X_UP_DEVCAP_SCREENPIXELS');
&nbsp; }
&nbsp; if ($screen_res == '') {
&nbsp; &nbsp; $screen_res = read_global('HTTP_X_JPHONE_DISPLAY');
&nbsp; }
&nbsp; $res_array = preg_split('/[x,*]/', $screen_res);
&nbsp; if (count($res_array) == 2) {
&nbsp; &nbsp; $GLOBALS['google']['u_w']=$res_array[0];
&nbsp; &nbsp; $GLOBALS['google']['u_h']=$res_array[1];
&nbsp; }
}

function google_set_muid() {
&nbsp; $muid = read_global('HTTP_X_DCMGUID');
&nbsp; if ($muid != '') {
&nbsp; &nbsp; $GLOBALS['google']['muid']=$muid;
&nbsp; &nbsp; &nbsp;return;
&nbsp; }
&nbsp; $muid = read_global('HTTP_X_UP_SUBNO');
&nbsp; if ($muid != '') {
&nbsp; &nbsp; $GLOBALS['google']['muid']=$muid;
&nbsp; &nbsp; &nbsp;return;
&nbsp; }
&nbsp; $muid = read_global('HTTP_X_JPHONE_UID');
&nbsp; if ($muid != '') {
&nbsp; &nbsp; $GLOBALS['google']['muid']=$muid;
&nbsp; &nbsp; &nbsp;return;
&nbsp; }
&nbsp; $muid = read_global('HTTP_X_EM_UID');
&nbsp; if ($muid != '') {
&nbsp; &nbsp; $GLOBALS['google']['muid']=$muid;
&nbsp; &nbsp; &nbsp;return;
&nbsp; }
}

function google_set_via_and_accept() {
&nbsp; $ua = read_global('HTTP_USER_AGENT');
&nbsp; if ($ua == '') {
&nbsp; &nbsp; $GLOBALS['google']['via']=read_global('HTTP_VIA');
&nbsp; &nbsp; $GLOBALS['google']['accept']=read_global('HTTP_ACCEPT');
&nbsp; }
}

function google_get_ad_url() {
&nbsp; $google_ad_url = 'http://pagead2.googlesyndication.com/pagead/ads?';
&nbsp; google_append_url($google_ad_url, 'dt',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; round(1000 * array_sum(explode(' ', microtime()))));
&nbsp; foreach ($GLOBALS['google'] as $param =&gt; $value) {
&nbsp; &nbsp; if (strpos($param, 'color_') === 0) {
&nbsp; &nbsp; &nbsp; google_append_color($google_ad_url, $param);
&nbsp; &nbsp; } else if (strpos($param, 'url') === 0) {
&nbsp; &nbsp; &nbsp; $google_scheme = ($GLOBALS['google']['https'] == 'on')
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ? 'https://' : 'http://';
&nbsp; &nbsp; &nbsp; google_append_url($google_ad_url, $param,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $google_scheme . $GLOBALS['google'][$param]);
&nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; google_append_globals($google_ad_url, $param);
&nbsp; &nbsp; }
&nbsp; }
&nbsp; return $google_ad_url;
}

$google_ad_handle = @fopen(google_get_ad_url(), 'r');
if ($google_ad_handle) {
&nbsp; while (!feof($google_ad_handle)) {
&nbsp; &nbsp; echo fread($google_ad_handle, 8192);
&nbsp; }
&nbsp; fclose($google_ad_handle);
}

?&gt;