NOTE: This is only here for historical purposes. The script has since been updated and the latest version is available from:

PHP Adsense-Referrals Script Version 2.1

There were a few bugs in version 2 of my script, so I am including the changes below:
The following code should be removed from below the adsense referral array:

$using_firefox = preg_match("/firefox/i", $_SERVER['HTTP_USER_AGENT']);

and placed below:

$referrals = 0;


The following code should be deleted:

function rand_referral() {
  global $using_firefox;
  if($using_firefox == 1) {
    $referral = rand(2,4);
  } else {
    $referral = rand(1,4);
  }
  return $referral;
}

The following code

if($using_firefox == 1) {
  $referral = rand(2,4);
} else {
  $referral = rand(1,4);
}

should be placed after:

AND $adsense_referral['picasa'] == 1) {
  exit;
}

The code:

if($referral == 1 AND $adsense_referral['firefox'] == 0) {

should be replaced with:

if($referral == 1 AND $adsense_referral['firefox'] == 0
AND $using_firefox == 0) {

Once those changes have been made, the Firefox referral won’t be displayed when the visitor is using Firefox as a browser.

Share and Enjoy:
  • Twitter
  • StumbleUpon
  • Facebook
  • del.icio.us
  • Mixx
  • Propeller
  • BlinkList
  • Simpy

Related posts:

  1. A PHP Google Adsense Referrals Script Version 2
  2. PHP Adsense-Referrals Script Version 2.1
  3. A PHP Google Adsense Referrals Script
  4. The Best Adsense Plugin For Wordpress
  5. Adsense Ad Management Simplified