Password Protect Site
Does your client want to limit access to certain pages on your site? Or do you want to keep a demo catalog private? The site builder system does not allow password protection, but you can add some simple protection in with a little bit of coding.
Please note! This is not a full password system, and is not meant for creating secure sites. It is simply a way to quickly add a basic user name and password to a page. Each person will need that same user name and password to access your site pages.
-
Create a file named 'authentication.php'.
-
In that file, add the following code:
Authorization Required
Changing "user" to the user name you wish to use, and "pass" to the password you wish to use.*
-
If you wish, change
Authorization Required
to whatever you'd like your page to read when a user clicks the 'Cancel' button. Note that this can include HTML code.
-
Load the file into the /enc/ folder of your site.
-
Open the index.php page in the main public_html folder.
-
Just under the line:
require_once("stconfig.php");add the following code:
require(SB_INC_DIR ."/authentication.php");
-
Save the index.php file.
-
Repeat steps 5-7 above with any other pages you wish to protect (ie. affiliates.php, articles.php, catalog.php, certificates.php, contact.php, events.php, faqs.php, guestbook.php, orders.php, registry.php, search.php, sitemap.php, sitesearch.php, weblinks.php, wholesale.php).
* Use the same user name and password for each page, and give that user/password combo to any person who should have access to your system. Everyone will use the same user name and password to access the site.
Hint: For demos, change the user name and password monthly, to ensure that only those who really want to access your site can do so.