I'm trying to setup php code (i'm new to this) what I'm trying to do is list 3 different websites in the php code and have the website visitor sent to any of the listed websites randomly.
Here's my current code which isn't working:
Code: Select all
<?php
if($_SERVER['HTTP_REFERER'])
{
$random = rand(0, 3);
$aff_array = array("http://www.RANDOMSITE1.COM",
"http://RANDOMSITE2.COM",
"http://RANDOMSITE3.COM");
header('Location: $aff_array[$random]');
exit();
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>First there's a code that determines if the website visitor has a referer (ie: came from another website) if they have a referer I would like to them to be redirected randomly to one of the above websites.
If they don't have a referer then the website just loads it's content (reason I left the html tags at the bottom of the code) and doesn't redirect.
The person that posted this script (they removed it, I think it had too many errors) also said this:
"What that does, it creates a random number from 0 to 3, then in the aff_array put all of your different websites, only 1 of them will be chosen to be redirected to."
They also stated this:
"Just to clear things up again, this script changes the referrer from wherever you posted your link to the referrer of the website with above code and then randomly picks 1 of several websites and redirects to it. "
I checked yesterday on various php forums and was told that it's not possible to change the referer? Is that correct?
Thanks