Results 1 to 2 of 2

Thread: PHP Redirect Question

  1. #1
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default PHP Redirect Question

    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

  2. #2
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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.
    Last edited by JordanReich; 02-06-2009 at 11:08 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •