Lockbox Setup

Overview
The procedure to setup a lockbox is a fairly easy one. Please follow this tutorial for assistance.
1 Secure Lockbox Folder
Firstly, you must create a new folder inside your 'members' folder. This folder is required to have read/write permissions. 755/777 on linux. The folder can be called anything you wish. In this example we`ll call it 'lockbox1'.
2 Public Lockbox Folder
The public folder is the folder where you`ll add your protected content and is where your visitors will login to access. On install you`ll see a folder called 'secure-folder'. You can use this one or create a new one. For example, you might wish to call it 'members-area' etc.

So, now you have 2 folders, one inside your 'members' folder outside of your root and one inside your root.
3 Add Lockbox
In your admin area select 'Lockboxes > Add New Lockbox' from the left menu. Enter a new name for your lockbox and then select the matching folder pairs that relate to this lockbox. Example:



Lockbox (.htpasswd) Folder = Folder in 'members' folder
Public HTML Folder = Public folder
4 Redirects
You can use the system redirect pages (already selected) or add urls to your own custom pages. For your first lockbox, it is recommended you use the system ones until you understand how everything works.
5 Add Lockbox to System
When you are happy with everything click the "Add New Lockbox" button to add lockbox to the system. The lockbox will now be shown on the lockbox management page like in the following screenshot:



Click the icon to access the setup information. See next step.
6 Public Folder .htaccess Setup
The final step is to setup .htaccess for the public folder to envoke a password authentication box. So, click the icon to load the setup screen. The link is shown in the above screenshot. 2 boxes will be shown.

The first box contains the .htaccess code. This must be saved to a file called '.htaccess' and added to your public folder. The second is a PHP index file that must be added alongside the .htaccess file, so your public folder contains 2 files.

secure-folder/.htaccess
secure-folder/index.php


IMPORTANT! If you have an existing .htaccess file and have Options -Indexes set, this may prevent the lockbox from working.
Lockbox Setup Complete
Your lockbox is now ready. If you add other lockboxes, follow the same procedure.

Next you should setup some packages and set up your signup pages. You can then proceed to test the payment and member options. Adding a fixed access member manually is a good way to test that your public folders password protection is working ok.
Preset Objects (Advanced Users ONLY)
If you are using PHP to build your pages, you can access any of the following objects, which are created by the lockbox system:

$LB_MEM - Object of the members table for the logged in user. Reference any field in the members table.

Example:
<?php echo $LB_MEM->name; ?>
<?php echo $LB_MEM->username; ?>
$LB_BOX - Object of the lockbox table for the logged in user. Reference any field in the lockbox table.

Example:
<?php echo $LB_BOX->name; ?>
$LB_PACKAGE - Object of the packages table for the logged in user. Reference any field in the packages table.

Examples:
<?php echo $LB_PACKAGE->name; ?>
If you prefer to work with arrays, convert objects to arrays like this:

(array)$LB_MEM

Example:
<?php echo $LB_MEM['name']; ?>
<?php echo $LB_MEM['username']; ?>
etc etc
Custom Triggers (Advanced Users ONLY)
You may want to perform additional operations when someone successfully logs in. Add your code to the following file, which triggers each time someone logs in:

control/lockbox-custom.php