Reverend
11-10-2004, 02:04 PM
Here's the setup: User clicks on a link on one page, and that link opens up in a new window. The new window has an iframe inside of it. Ideally, this is how people would view the page - in the iframe. I want to have this set up so if they try to go to that page directly (as in, without viewing it via the new window as described above), they'll be redirected to another page. However, if they do view it in the new window/iframe, no redirection will occur. I know how to write a basic redirection code, but a basic one would cause a redirection regardless as to how the page is being viewed (within another page or not). I want to be able to have the redirect occur only if the condition described above occurs.
I tried using the following code, however it results in a loophole of constant refreshing..
<?php
if ($_SERVER['HTTP_REFERER']="./index.html"){
echo "<body onload=\"document.location.href='as.php'\">";
}
else {
echo "<body onload=\"document.location.href='./index2.html'\">";
}
?>
Any help would be greatly appreciated. Thanks in advance.
I tried using the following code, however it results in a loophole of constant refreshing..
<?php
if ($_SERVER['HTTP_REFERER']="./index.html"){
echo "<body onload=\"document.location.href='as.php'\">";
}
else {
echo "<body onload=\"document.location.href='./index2.html'\">";
}
?>
Any help would be greatly appreciated. Thanks in advance.