Integrating OpenCrypt's PHP Login Interface
Friday 4th September 2009

If you wish to use OpenCrypt's PHP Login Interface to manage your logins, rather than the standard .htaccess pop-up login prompt, you must include login.php in the pages that you want to secure. The login.php file is found in your OpenCrypt 'php' directory.
Including login.php also enables OpenCrypt's logging and tracking to be used on each page, and enables you to access user and account details as PHP variables for use in your pages. It is recommended you include login.php in all of your pages, even those that aren't secured.
For guidance setting up OpenCrypt's PHP Login Interface, please see: http://www.opencrypt.com/faq.php?q=186
Details that can be included in your pages

To include details about the current user in your page, the following variables should be used:
Username: $dbusername
Email: $dbemail
First Name: $dbfname
Last Name: $dblname
Subscription ID: $dbsub_id
Account Active: $dbactive
Account Created: $dbdate_opened
Account Expires: $dbdate_expire
Current Points Balance: $dbpoints
Click here for further information.
If you are using custom form fields during the registration process, the data from these is available in an array, the key being 'field1' to 'field50', e.g. $dbfield['field1'] or $dbfield['field25'].
There will always be an up-to date list available in the OpenCrypt FAQ, which includes variables and details of how to add these fields to the standard OpenCrypt templates.
For future versions of OpenCrypt, simply browse the FAQ for the 'PHP Login Interface' category and select the latest revision.
Search Engines

If you wish to allow search engines to crawl your secure content, you can enable the SEO functionality of the PHP Login interface. This will enable crawler bots from all the major search engines (including Google, Searchme, Yahoo, Live and MSN) to access your secure content.
Firstly, setup an account in OpenCrypt called 'googlebot'. This will enable you to track the traffic from the bots directly from the OpenCrypt administration panel, enabling you to get a more detailed understanding of the traffic passing through your site.
To enable the search engine features of login.php, the following variable must be set before login.php is included in your page.
$login_seo = "1";
require "/path/to/login.php";
We recommend also printing the $header_html variable in your headers, as this prevents the bots from archiving your secure content (for example Google's cache feature) and therefore making it available to anyone. Alternatively, simply place the following tag in your HTML header:
<meta name="googlebot" content="noarchive">
Using login.php and the .htaccess login prompt simultaneously

If you are using both PHP and .htaccess options for user logins to the OpenCrypt system, then it is possible to setup login.php within a .htaccess member's area so the standard features of login.php are available even when it's not being used to manage user login. To do this, the following variable must be set before login.php is included in your page.
$login_popup = "1";
require "/path/to/login.php";
Shopping Basket

The shopping basket is another handy function provided by the OpenCrypt PHP Interface. The basic shopping basket is called from header.php with the following code:
if ($shopping_basket) {
print <<<END
<form action="$url_php/basket.php" method="get"
style="margin:0px">
<table cellpadding="8" cellspacing="0" border="0"><tr><td nowrap>
<span class="span_font_note"> $shopping_basket </span>
</td></tr></table>
</form>
END;
}
The code for the shopping basket itself is located in the OpenCrypt /php/ directory, at the tail of the shopping.php file. Note the main shopping cart variables are included in this file.
$shopping_basket =<<<END
<b><a href="$url_php/basket.php" class="span_font_note">
Shopping Basket:</a></b>
$total_quantity item$print_s ($currency$total_price)
<input type="submit" value="Buy" name="submit"
class="cartbuybutton">
END;
Amending these files, and the appropriate CSS for the class 'cartbuybutton' (in header.php) enables you to redesign the shopping basket as you require, to suit the look of your site. Some examples of this include OpenCrypt.com's shopping basket which uses a curved-edge and A-Z-Animals.com which uses an integrated shopping basket with an AJAX system to enable you to increase and decrease cart quantity interactively while you are shopping.
We hope these examples give you a few useful tips if you plan to, or are already using OpenCrypt's PHP Login Interface.
Share this article:
|
<- Developing Mobile Web Sites
|
IP Location API ->
|
|