Ok.... I think this will work for you... Put the first code in the beginning of your index page.
Code:
<?php include("filename.php"); ?>
See filename.php above. That should be whatever you name the next file code below... So copy the code below into a php file. Name it whatever you want and call it by using the code above (and change to whatever your file name is) in your index page.
Code:
<?php
// call this page with ?ref=1 or 2 or 3, any number pointing to one of the links from $merchanturls array.
$merchanturls[0] = $_SERVER['PHP_SELF'];
$ref=$_GET["ref"];
if (!empty($ref)) {
echo "<html><body onload=\"javascript:frmClickTracking.submit();\">";
echo "<form action=\"" . $merchanturls[0] . "\" method=\"post\" name=\"frmClickTracking\">";
echo "<input type=\"hidden\" name=\"ref\" value=\"" . $ref . "\" />";
echo "</form></body></html>";
exit;
}
$merchanturls[dell] = "http://dell.com";
$merchanturls[yahoo] = "http://yahoo.com";
$ref = $_POST['ref'];
if (!empty($ref)) {
if ($ref<=count($merchanturls)) {
$targeturl = $merchanturls[$ref];
if (!strpos($targeturl,"?")) {
echo "<html><body onload=\"javascript:frmClickTracking2.submit();\">";
echo "<form action=\"" . $targeturl . "\" method=\"get\" name=\"frmClickTracking2\">";
echo "</form></body></html>";
exit;
} else {
$pos = strpos($targeturl,"?");
$pageurl = substr($targeturl,0,$pos);
echo "<html><body onload=\"javascript:frmClickTracking3.submit();\">";
echo "<form action=\"" . $pageurl . "\" method=\"get\" name=\"frmClickTracking3\">";
$params = substr($targeturl,$pos+1);
$aparams = explode("&",$params);
for ($k=0;$k<count($aparams);$k++) {
$aparamvalues = explode("=",$aparams[$k]);
if (empty($aparamvalues[1])) $aparamvalues[1]="";
echo "<input type=\"hidden\" name=\"" . $aparamvalues[0] ."\" value=\"" . $aparamvalues[1] . "\" />";
}
echo "</form></body></html>";
exit;
}
}
}
?>
Now see in the code above $merchanturls[dell] = "http://dell.com";
[dell] is your code to send to "http://dell.com" ... you can name [dell] to whatever like [comp2323230] ....
So in the example above and what is in the code you should be able to redirect to dell by using the following: hxxp://yoursite.com?ref=dell (change to http)
If /?ref=dell is not there then it will stop at your index page.
Let me know if this works. Also a thanks would be nice