finalwebsites

createAdsense

Jan 18th, 2012
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. function get_adsense() {
  2.     $ad = 'no ad';
  3.     include_once '/home/username/geoip.inc';
  4.     $gi = geoip_open('/home/username/GeoIP.dat', GEOIP_MEMORY_CACHE);
  5.     $country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
  6.     if(!in_array($country, array('IN', 'CN'))) {
  7.         $ad = '
  8.     <script type="text/javascript"><!--
  9.     google_ad_client = "ca-pub-xxx";
  10.     /* WDB - 468x60 */
  11.     google_ad_slot = "5036714934";
  12.     google_ad_width = 468;
  13.     google_ad_height = 60;
  14.     //-->
  15.     </script>
  16.     <script type="text/javascript"
  17.     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  18.     </script>';
  19.     }
  20.     return $ad;
  21. }
  22.  
  23. function createAdsense468by60() {
  24.     ?>
  25.     <!--mfunc return get_adsense() -->
  26.     <?php return get_adsense(); ?>
  27.     <!--/mfunc-->
  28.     <?php
  29. }
  30.  
  31. add_shortcode('adsense46860', 'createAdsense468by60');
Advertisement
Add Comment
Please, Sign In to add comment