Hi,
I use Iframes and want to rotate different CPA offers.
I have created a redirect using the second method with a seperate redirect php file.
Then I have included this script. Will this work? Will all subid's be parsed correctly?
<?php
$offer[1] = 'http://www.affiliate_url_1&subid=';
$offer[2] = 'http://www.affiliate_url_2&subid=';
$offer[3] = 'http://www.affiliate_url_3&subid=';
//this is the text file, which will be stored in the same directory as this file,
//count.txt needs to be CHMOD to 777, full privlledges, to read and write to it.
$myFile = "count.txt";
//open the txt file
$fh = @fopen($myFile, 'r');
$offerNumber = @fread($fh, 5);
@fclose($fh);
//see which landing page is next in line to be shown.
if ($offerNumber >= count($offer)) {
$offerNumber = 1;
} else {
$offerNumber = $offerNumber + 1;
}
//write to the txt file.
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $offerNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);
//redirect to the affilate url, + add the subid at the end
header('location: ' .$offer[$offerNumber] . $_COOKIE['t202proSubid']);
?>
Thanks!
Morten.