Rotating PHP script issue

ryannull

Senior Member
Joined
Feb 27, 2012
Messages
805
Reaction score
335
I am having issues with a rotating php script.

What I am trying to do is redirect traffic to 2 different landing pages and clear the referrer. It MUST clear the meta referrer. The script I am trying to use keeps getting an error. I can't seem to figure it out.

PHP:
<?php
$link[] = "http://www.url1.com";
$link[] = "http://www.url2.com";

$random_number = rand(0,count($link)-1);
$redirectlink = $link[$random_number];

header("Refresh 0; Location: $redirectlink");
exit;
?>

Any help would be greatly apprectiated.
 
I have removed the "Refresh 0;" and it will work, but not clear the referrer.
 
Umm, that's weird.

Check this code:

PHP:
<?php
$link[] = "http://www.whatismyreferer.com/";
$link[] = "http://www.whatsmyreferer.com/";


$random_number = rand(0,count($link)-1);
$redirectlink = $link[$random_number];


header("Location: $redirectlink");
exit;

Both of these can't detect the referer.
 
I'd suggest trying HTML's meta refresh
 
copy paste this code and you are good to go

Code:
<?php
$link[] = "http://www.url1.com";
$link[] = "http://www.url2.com";

$random_number = rand(0,count($link)-1);
$redirectlink = $link[$random_number];

header("Refresh 0; Location: $redirectlink");
exit;
?>
 
This code still shows the referrer.
 
This code still shows the referrer.

that's a different thing
in original post you mentioned its displaying error
if you want to hide referrer then try something like double meta refresh ( still it wont solve the problem for every browser )
 
Try to use https:// instead of http:// or double redirect.
 
Back
Top