Help with cloaker

shopdeal

Member
May 2, 2010
874
4
18
I usually use the code below to split test landing pages. It only passes the kw variable.

What changes should i make if i want to add in say 'kw' and 'c1' ?

<?php

$kw = $_GET['kw'];

$cloaked = 'http://xxxxx.com/offerx/lp1.php?t202id=21398&t202kw=';

$real[] = 'http://xxxxx2.com/index.php?t202id=114&t202kw=';
$real[] = 'http://xxxxx3.com/index.php?t202id=314&t202kw=';



$myFile = "counter.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($real)-1) {
$offerNumber = 0;
} 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);

$real = $real[$offerNumber].$kw;

// Set this to $cloaked or $real
$location = $real;

header('Location: '.$location);

?>
 


// Add to beginning under kw
$param2 = (isset($_GET['c1'])) ? "&c1=".$_GET['c1'] : "";
$param3 = (isset($_GET['c2'])) ? "&c2=".$_GET['c2'] : "";

// replace original $real = $real[$offerNumber].$kw;
$real = $real[$offerNumber].$kw.$param2.$param3;

Didn't test though.
 
  • Like
Reactions: shopdeal