Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Aiheen aloitti: Cario Blingz - elokuu 11, 2011, 07:45:14 IP

Otsikko: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 11, 2011, 07:45:14 IP
Please i someone to help me fix my google adsense and admob at the top and buttom of my mobile forum please am begging you guys
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 11, 2011, 07:49:59 IP
here are the codes

this is for adsense


<?php

$GLOBALS
['google']['ad_type']='text';
$GLOBALS['google']['channel']='***************';
$GLOBALS['google']['client']='pub-*************';
$GLOBALS['google']['format']='mobile_single';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='xhtml';
$GLOBALS['google']['oe']='utf8';
$GLOBALS['google']['output']='xhtml';
$GLOBALS['google']['ref']=read_global('HTTP_REFERER');
$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) {
  return isset(
$_SERVER[$var]) ? $_SERVER[$var]: '';
}

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

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

function 
google_append_color(&$url$param) {
  global 
$google_dt;
  
$color_array split(','$GLOBALS['google'][$param]);
  
google_append_url($url$param,
                    
$color_array[$google_dt sizeof($color_array)]);
}

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

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

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

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

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

?>
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 11, 2011, 07:51:25 IP
while this is for admob and will stay below


  <?php
// AdMob Publisher Code
// Language: PHP (curl)
// Version: 20081105
// Copyright AdMob, Inc., All rights reserved
// Documentation at http://developer.admob.com/wiki/Main_Page

$admob_params = array(
  
'PUBLISHER_ID'      => '**********'// Required to request ads. To find your Publisher ID, log in to your AdMob account and click on the "Sites & Apps" tab.
  
'ANALYTICS_ID'      => 'your_analytics_site_id'// Required to collect Analytics data. To find your Analytics ID, log in to your Analytics account and click on the "Edit" link next to the name of your site.
  
'AD_REQUEST'        => true// To request an ad, set to TRUE.
  
'ANALYTICS_REQUEST' => false// To enable the collection of analytics data, set to TRUE.
  
'TEST_MODE'         => true// While testing, set to TRUE. When you are ready to make live requests, set to FALSE.
  // Additional optional parameters are available at: http://developer.admob.com/wiki/AdCodeDocumentation
  
'OPTIONAL'          => array()
);

// Optional parameters for AdMob Analytics (http://analytics.admob.com)
//$admob_params['OPTIONAL']['title'] = "Enter Page Title Here"; // Analytics allows you to track site usage based on custom page titles. Enter custom title in this parameter.
//$admob_params['OPTIONAL']['event'] = "Enter Event Name Here"; // To learn more about events, log in to your Analytics account and visit this page: http://analytics.admob.com/reports/events/add

/* This code supports the ability for your website to set a cookie on behalf of AdMob
 * To set an AdMob cookie, simply call admob_setcookie() on any page that you call admob_request()
 * The call to admob_setcookie() must occur before any output has been written to the page (http://www.php.net/setcookie)
 * If your mobile site uses multiple subdomains (e.g. "a.example.com" and "b.example.com"), then pass the root domain of your mobile site (e.g. "example.com") as a parameter to admob_setcookie().
 * This will allow the AdMob cookie to be visible across subdomains
 */
//admob_setcookie();

/* AdMob strongly recommends using cookies as it allows us to better uniquely identify users on your website.
 * This benefits your mobile site by providing:
 *    - Improved ad targeting = higher click through rates = more revenue!
 *    - More accurate analytics data (http://analytics.admob.com)
 */
 
// Send request to AdMob. To make additional ad requests per page, copy and paste this function call elsewhere on your page.
echo admob_request($admob_params);

/////////////////////////////////
// Do not edit below this line //
/////////////////////////////////

// This section defines AdMob functions and should be used AS IS.
// We recommend placing the following code in a separate file that is included where needed.

function admob_request($admob_params) {
  static 
$pixel_sent false;

  
$ad_mode false;
  if (!empty(
$admob_params['AD_REQUEST']) && !empty($admob_params['PUBLISHER_ID'])) $ad_mode true;
  
  
$analytics_mode false;
  if (!empty(
$admob_params['ANALYTICS_REQUEST']) && !empty($admob_params['ANALYTICS_ID']) && !$pixel_sent$analytics_mode true;
  
  
$protocol 'http';
  if (!empty(
$_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off'$protocol 'https';
  
  
$rt $ad_mode ? ($analytics_mode 0) : ($analytics_mode : -1);
  if (
$rt == -1) return '';
  
  list(
$usec$sec) = explode(' 'microtime()); 
  
$params = array('rt=' $rt,
                  
'z=' . ($sec $usec),
                  
'u=' urlencode($_SERVER['HTTP_USER_AGENT']), 
                  
'i=' urlencode($_SERVER['REMOTE_ADDR']), 
                  
'p=' urlencode("$protocol://" $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']),
                  
'v=' urlencode('20081105-PHPCURL-acda0040bcdea222')); 

  
$sid = empty($admob_params['SID']) ? session_id() : $admob_params['SID'];
  if (!empty(
$sid)) $params[] = 't=' md5($sid);
  if (
$ad_mode$params[] = 's=' $admob_params['PUBLISHER_ID'];
  if (
$analytics_mode$params[] = 'a=' $admob_params['ANALYTICS_ID'];
  if (!empty(
$_COOKIE['admobuu'])) $params[] = 'o=' $_COOKIE['admobuu'];
  if (!empty(
$admob_params['TEST_MODE'])) $params[] = 'm=test';

  if (!empty(
$admob_params['OPTIONAL'])) {
    foreach (
$admob_params['OPTIONAL'] as $k => $v) {
      
$params[] = urlencode($k) . '=' urlencode($v);
    }
  }

  
$ignore = array('HTTP_PRAGMA' => true'HTTP_CACHE_CONTROL' => true'HTTP_CONNECTION' => true'HTTP_USER_AGENT' => true'HTTP_COOKIE' => true);
  foreach (
$_SERVER as $k => $v) {
    if (
substr($k04) == 'HTTP' && empty($ignore[$k]) && isset($v)) {
      
$params[] = urlencode('h[' $k ']') . '=' urlencode($v);
    }
  }
  
  
$post implode('&'$params);
  
$request curl_init();
  
$request_timeout 1// 1 second timeout
  
curl_setopt($requestCURLOPT_URL'http://r.admob.com/ad_source.php');
  
curl_setopt($requestCURLOPT_RETURNTRANSFER1);
  
curl_setopt($requestCURLOPT_TIMEOUT$request_timeout);
  
curl_setopt($requestCURLOPT_CONNECTTIMEOUT$request_timeout);
  
curl_setopt($requestCURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded''Connection: Close'));
  
curl_setopt($requestCURLOPT_POSTFIELDS$post);
  list(
$usec_start$sec_start) = explode(' 'microtime());
  
$contents curl_exec($request);
  list(
$usec_end$sec_end) = explode(' 'microtime());
  
curl_close($request);

  if (
$contents === true || $contents === false$contents '';

  if (!
$pixel_sent) {
    
$pixel_sent true;
    
$contents .= "<img src=\"$protocol://p.admob.com/e0?"
              
'rt=' $rt
              
'&amp;z=' . ($sec $usec)
              . 
'&amp;a=' . ($analytics_mode $admob_params['ANALYTICS_ID'] : '')
              . 
'&amp;s=' . ($ad_mode $admob_params['PUBLISHER_ID'] : '')
              . 
'&amp;o=' . (empty($_COOKIE['admobuu']) ? '' $_COOKIE['admobuu'])
              . 
'&amp;lt=' . ($sec_end $usec_end $sec_start $usec_start)
              . 
'&amp;to=' $request_timeout
              
'" alt="" width="1" height="1"/>';
  }
  
  return 
$contents;
}

function 
admob_setcookie($domain ''$path '/') {
  if (empty(
$_COOKIE['admobuu'])) {    
    
$value md5(uniqid(rand(), true));
    if (!empty(
$domain) && $domain[0] != '.'$domain ".$domain";
    if (
setcookie('admobuu'$valuemktime(000112038), $path$domain)) {
      
$_COOKIE['admobuu'] = $value// make it visible to admob_request()
    

  }
}
  
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 11, 2011, 07:55:03 IP
here are some of my templates files

thanks in advance
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Illori - elokuu 11, 2011, 07:55:25 IP
please dont bump if you have more information to add you can modify your existing post to add the information.
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 11, 2011, 07:57:40 IP
Lainaus käyttäjältä: Illori - elokuu 11, 2011, 07:55:25 IP
please dont bump if you have more information to add you can modify your existing post to add the information.
am sorry about that please illori help me out please
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Illori - elokuu 11, 2011, 07:59:03 IP
begging will not get you further then bumping will.
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 12, 2011, 11:12:01 IP
still waiting for helpers, thanks in advance
Otsikko: Re: Please i someone to help me fix my Wap/Mobile google adsense/admob add
Kirjoitti: Cario Blingz - elokuu 14, 2011, 10:05:11 AP
if you guys can't help me here, were do you want me to go ???