Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zero-master/5300868 to your computer and use it in GitHub Desktop.
Save zero-master/5300868 to your computer and use it in GitHub Desktop.
Prosper202 Offer Rotator and Tracker
<?php
/*
-------------------------------------------------------------------------------------------------
Offer Link Rotation Script
Last edit: 2/25/2010
http://www.ctrtard.com
This script is designed to work with Prosper202
Parts ripped from Wes's landing page rotation script
Add offer links below. An unlimited number of urls are supported.
In Prosper202, set up an Advanced Landing Page when you will be split testing offers.
Then go to Step #6 Get LP code. Get your Outbound PHP Redirect Urls and paste them below.
*** Important*** Make sure you add the [] brackets as shown.
e.g. $tracking202outbound[] = 'http://202domain.com/tracking202/redirect/off.php?acip=545&pci='.$_COOKIE['tracking202pci'];
-------------------------------------------------------------------------------------------------
*/
$tracking202outbound[] = 'http://198.27.81.195/tracking202/redirect/off.php?acip=619&pci='.$_COOKIE['tracking202pci']; $tracking202outbound[] = 'http://google.com/'; // fake example, delete this
$tracking202outbound[] = 'http://198.27.81.195/tracking202/redirect/off.php?acip=619&pci='.$_COOKIE['tracking202pci'];
$tracking202outbound[] = 'http://198.27.81.195/tracking202/redirect/off.php?acip=837&pci='.$_COOKIE['tracking202pci'];
$use_count_file = 1; // Set this to 1 to use a count.txt file. This allows 100% even rotation.
// You need to make sure the file 'count.txt' is writeable. (Chmod 777)
// Set this to 0 and rotation is random. Not as good, but nicer to the
// server if you're getting a ton of clicks.
/*
-------------------------------------------------------------------------------------------------
STOP!! No need to edit below this line.
-------------------------------------------------------------------------------------------------
*/
if (count($tracking202outbound) < 1) die ('Error! No links are defined.');
if ($use_count_file) {
$my_file = "count.txt";
$fh = @fopen($my_file, 'r');
$link_num = @fread($fh, 5);
@fclose($fh);
if ($link_num >= count($tracking202outbound)-1) {
$link_num = 0;
} else {
$link_num = $link_num + 1;
}
$fh = @fopen($my_file, 'w') or die("Error! Can't open $my_file!");
@fwrite($fh, $link_num . "\n" )or die("Error! Can't write to $my_file!");
@fclose($fh);
header('Location: ' . $tracking202outbound[$link_num] );
} else { // this is random number based rotation, no count file is used.
$link_num = rand(0, count($tracking202outbound)-1 );
header('Location: ' . $tracking202outbound[$link_num] );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment