Log in

View Full Version : PHP Redirect Question



JordanReich
02-06-2009, 08:03 PM
Hey guys I'm trying to make it so that you can only use a certain page within an iframe and not outside of the iframe (I.E. the forums) for some reason this code however is stumping me.



<?php
if ($_SERVER["HTTP_HOST"] != "www.test.com") {
header("Location: http&#x3a;//www&#x2e;test&#x2e;com".$_SERVER["PHP_SELF"]);
}
?>


Could someone explains how it works.

I want to make it that whenever someone enters http://www.uba-clan.com/z5y9ve that they are redirected to http://www.uba-clan.com/v3/secureforum.php which in turn is an iframe that access's the link above from within the iframe however the browser URL will say the correct thing.

Is this possible with this code, and if so could someone input that into the coding so I can get how it would look as I cant seem to get it to work.

Thanks

JordanReich
02-06-2009, 11:01 PM
I tried



<?php
header( 'Location: http://www.uba-clan.com/v3/secureforum.php' ) ;
?>


The problem is that it now redirects me to the right page obviously, but once I get their everypage inside of the iframe refreshes again creating more or less a cascading refresh effect.

Or perhaps



<?php
$headervar =
?>
<?php
if($headervar == true){
header( 'Location: http://www.uba-clan.com/v3/secureforum.php' ) ;
exit;
}elseif($headervar == false){
exit;
}
?>


$headervar = (whatever the code is to grab a variable out of the Address Bar) and then when it looks if true (redirect) if false fall out of the cycle.