Simple newbie question

Discussion in 'Setting-up protection' started by AgentHi5, Jul 29, 2004.

  1. AgentHi5

    AgentHi5 Guest

    I've read through the existing forum posts and am still a little confused. I want to use aMember protection for several files in a directory, but not the entire directory. All the pages are php files. I have added the aMember php include statements to each of the files yet the files are accessible without login. Is there something else I need to do? Do I need to use .htaccess, .htpasswd, or .htgroup files? If so, how?

    Thanks

    Brian :confused:
  2. tomarriola

    tomarriola Member

    Joined:
    Mar 29, 2003
    Messages:
    140
    Those .htaccess methods protect a directory. To protect php files I use PHP_Include. Below is the info from the readme, available thru setup. All you need to do is add a couple lines to the top of the php page you want to potect.

    Here is what goes in the php pages I am protecting:
    <?php
    $_product_id = array(1,2,3,4,5,6,7,8,9,10);
    require_once '/home/sites/site1/web/amember/plugins/protect/php_include/check.inc.php';
    ?>

    Tom


    PHP_INCLUDE protect plugins.

    Add cookie-based login for protected-pages. It can only protect
    PHP files, of course. But it very useful to include payed
    membership-support to your existsing PHP-based application.
    Also it log access to special db table - you able to view it
    later via admin interface.
    This module also used in member.php to do authentication for
    members. So if you need to change something, you should create new
    plugin, based on this code.

    Just include /home/sites/site1/web/membership/plugins/php_include/check.inc.php
    in your PHP page as follows:
    ============================================================================

    .. your html still here, if exists
    ============================================================================

    If user is not authorized, this code will display login page :
    (template: templates/login.html).

    Yout MUST define $_product_id array to work. If you want to only check
    access login/password then use it as :
    $_product_id = array('ONLY_LOGIN');
    It only check login/password pair. It will allow access for not-paid or expired members!
    You are warned!

    User can use http://www.yoursite.com/aMember_Root/plugins/protect/php_include/logout.php
    to logout. You can set location for redirect after logout in admin panel.

Share This Page