HowTo use php on Protected Content -> pages ?

Discussion in 'aMember Pro v.4' started by autoapproveclub, Nov 15, 2011.

  1. autoapproveclub

    autoapproveclub New Member

    Joined:
    Nov 14, 2011
    Messages:
    2
    Hi

    i try to make a protected page with my own php code. but it displays the php code even if i use the sourcecode tab instead of interpret the code.
    need help

    thank you
  2. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    What have you called your page - web address that is?
  3. autoapproveclub

    autoapproveclub New Member

    Joined:
    Nov 14, 2011
    Messages:
    2
    i used the option in admin menu

    products -> protected content -> pages (Tab)

    i added some php code in the wysisyg editor in use of the sourcecode option

    but when i save the content, the php code is displayed on the page instead of interpreted.

    for example i insert

    <?php echo "test"; ?>

    and click save.

    when i open the link , the site opens but it does not display the word "test"
    so amember does not interpret php....
  4. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    Question was what is the web address of the page in question not what you inserted within the page.

    aMember does not interpret php, the server does when it parses the page. To do this you have to tell the server the page contains php instructions by using file extensions such as '*.php'

    If the file extension is a plain 'html' one such as '*.html, *.htm' the php instructions will be treated as html and simply printed on the screen. So for your example you would see <?php echo "test"; ?> on the screen.

    A slight complication to the above! Above applies if you are calling a page as a complete entity in itself such as 'mydomain/thepage.htm however if that page is called as an 'include' (or a 'require') from within a php page then the html page is inserted within the php page and then the *.htm extension is ignored and the page is treated as being part of the php page.
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    This is expected. PHP is not allowed within Protected Pages. You can use html only.
  6. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
  7. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Is it possible to use
    Am_Lite::checkAccess(array(1,3), 'My Protected Page Title');
    with groups rather then individual products?

    David
  8. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Right now, it is not, but it can be done. Will it be useful?
  9. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    I think it would be simpler in some cases to protect content in groups rather than having to update the product number as you add products, you would add them to the existing protected group- unless I am misunderstanding the new group feature.

    David

Share This Page