protection not working as expected

Discussion in 'Setting-up protection' started by lokust, Dec 15, 2005.

  1. lokust

    lokust New Member

    Joined:
    Oct 21, 2005
    Messages:
    15
    I have a statement like this on several pages of my site.

    <?php
    if($_GET["var"] == "listings")
    { include 'listings.html';
    } elseif($_GET["var"] == "cocktails")
    { include 'cocktails.html';
    } elseif($_GET["var"] == "offers")
    { include 'http://www.mydomain.com/protected_dir/offers.php';
    } else {
    include 'information.html';
    }
    ?>

    The "offers" variable links to a page "offers.php" which is within an Amember protected directory. Presently clicking on "Offers" will call the Amember login page - If I sign-in I would expect to see the page "offers.php", though the login form continues to show.

    I have also logged into Amember and then browsed to this page expecting to see the "offers.php" page show by default - not happening - I get the Amember login page.

    offers.php looks like this:


    <h1>Offers</h1>

    <p>Offer number 1</p>
    <p>Offer number 2</p>
    <p>Offer number 3</p>


    Am I missing something here?

    Thanks,

    Al
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    It will not work, because page is requrested by server software. Your PHP file act as a browser in this case. Of course, it is not logged-in!
    Replace
    PHP:
    include
    to
    PHP:
    header("Location: http://www.mydomain.com/protected_dir/offers.php");
    exit();

Share This Page