can you setup a php site like this:
Posted: Mon Mar 02, 2009 1:31 am
I have a php file in a folder with a script like this:
Basically if there is a referer (visitor came from another website) then they are redirected randomly to 1 of 3 of my other sites above website1, website2, or website3. If they don't have a referer then they are not redirected and stay on the same page (reason for the html code below the php script).
What I'm wondering is when the visitor is redirected to website1, website2, or website3. Is it possible to have the same type of script as above but, in reverse? If the visitor has a referer they stay on the same page and if they don't have a referer then they are redirected to another different webpage? say for example website4.com ?
Thanks
Code: Select all
<?php
if($_SERVER['HTTP_REFERER'] != "")
{
$random = rand(0, 2);
$aff_array = array("http://www.website1.com",
"http://website2.com",
"http:/website3.com");
header("Location: ".$aff_array[rand(0,2)]);
exit();
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>What I'm wondering is when the visitor is redirected to website1, website2, or website3. Is it possible to have the same type of script as above but, in reverse? If the visitor has a referer they stay on the same page and if they don't have a referer then they are redirected to another different webpage? say for example website4.com ?
Thanks