I have several domains pointed to the same php script. Upon visit I want to redirect the user do a random domain of those, but only one time. To achieve this, I set a session variable, redirect and check for that variable.
My code is this:
session_start();
if($_SESSION['seen'] != 1) {
$_SESSION['seen'] = 1;
header("Location: ".$randomurl);
}
So it should only redirect 1 time if the user has never seen the page because afterwards the session variable would contain 1 and it would not redirect.
However this is redirecting me about 5 times till it stops on a page and I can't explain why.
Does anybody have a clue?