Setting up membership sites with NETbilling is a relatively easy process. It basically involves three steps:
If at any point, our instructions aren't working for you, you should contact your website hosting company, your system administrator, or someone who is familiar with operating systems and configuring CGI. |
Before you do this, you need to make three decisions:Where will you store your passwords?
This should be in a directory that is not accessible via the web. Most web hosting companies will set up your account so that you have a home directory that is off the web tree. This is where we suggest you keep your passwords.Where will you create your membership directory?
Most of the time, we suggest you simply create a directory called 'members' on the top level of your web tree. That way, you can send your members to a URL like http://www.mywebsite.com/members/Where can I run CGI programs on my website and how do I set them up?
Most of the time, there is a directory called cgi-bin where executable programs are placed. We are going to show you the most common way to setup these scripts and where to put our script. If at any point, our instructions don't make sense or aren't working for you, you should contact your website hosting company, your system administrator, or someone who is familiar with UNIX operating systems and configuring CGI.
With those things in mind, let's get started!
- Use an ftp client to login to your webserver
- Upload our membership script ( nbmember.cgi ) and configuration file ( nbmember.cfg ) to your cgi directory (usually cgi-bin). You can grab them from our server below:
- Shift-click to download control script nbmember.cgi
- Shift-click to download sample config file nbmember.cfg
- Logout and close your ftp client
- Open up a telnet client and log back into your website.
- You should be in your home directory when you login. At this point, you need to create a directory to store the password file, the password file itself, and set the proper permissions to the file so that the webserver can write to it. Here are the commands to execute:
mkdir passwords
touch passwords/htpasswd
chmod 666 passwords/htpasswd
- Make note of the full path to the file you just created. If your home directory is something like:
/home/htdocs
then the path do your passwords will be:
/home/htdocs/passwords/htpasswd
- Next, find out and make note of the location of perl on your website. Normally, it is located somewhere like:
/usr/bin/perl
To find out for sure, type the following:
which perl
That will tell you the location. You should also verify which version of perl you are running. Our script only works with versions 5 or higher. Find out by typing the following:
/usr/bin/perl -v
- Now, we need to edit the membership script file ( nbmember.cgi ) and the configuration file ( nbmember.cfg ) and get them ready for operation on your site. Change directories to your cgi directory as below:
cd cgi-bin
- Open nbmember.cgi into your favorite unix text editor (pico, vi, emacs, etc.)
- Find this line at the top of the script:
#!/usr/bin/perl
Make sure that matches the path to perl on your webserver. If not, change it. Save and close the file.
- Next, open nbmember.cfg , and locate the line:
HTPASSWD_FILE = "/path/to/htpasswd"
Change that path to the path where your password file is located.
- Next, locate the line:
###ACCESS_KEYWORD = "Change_This_Now!"
Get the Access Keyword from the Site Config Screen in your account. Replace the phrase Change_This_Now! with that access keyword. Remember it, or write it down, because you will need it later to enter it into the NETbilling Website Config screen. The purpose of the access keyword is to verify that your script is legitimate and validates your site to the NETbilling Website Management software.
- Save the file and exit your text editor.
- Change the permissions on nbmember.cgi to executable as below:
chmod 755 nbmember.cgi
- Change the permissions on nbmember.cfg to be able to be read by nbmember.cgi :
chmod 644 nbmember.cfg
- Your script should now be executable, and your config file should be readable. To test to see if it works, open a web browser and type in the URL of your script to see if it's working. For example: http://www.mywebsite.com/cgi-bin/ nbmember.cgi
If the script is working properly, you should get the following message:This error message just means that the script is working properly and that you didn't give it any parameters to work with, so everything is fine.
ERROR
INVALID COMMAND
supported cgi parameters:
-------------------------
cmd = {test
|append_user (post)
|delete_user (post)
|update_all_users (post)
|list_all_users}
u = <username>
p = <unix encrypted password>
w = <md5 encrypted apache/win32 password>
m = <md5 encrypted (unix) password>
n = <plain text password>
site_tag = <web site id>
challenge = <authentication token>
- Next, you must create the password popup box that will appear when your users attempt to login to your membership area. This is done by placing a file in your membership area called .htaccess.
- Change directories to your membership directory.
cd /home/htdocs/members
- Open a text editor and create a file called .htaccess
- Copy the following code into the file:
AuthUserFile /path/to/passwords/htpasswd
AuthGroupFile /dev/null
AuthName MembersOnly
AuthType Basic
<Limit POST GET PUT>
require valid-user
</Limit>
Change the pathname of /path/to/passwords/htpasswd to the correct location of your password file.
- Save your file and quit your text editor
- To test that this file works, enter the URL for your membership area in a web browser. It might be something like http://www.yoursite.com/members/
If you get a membership popup window then this portion is configured correctly. Now that that part is finished, let's move onto configuring your NETbilling account to accept passwords and track them for you.
Now it's time to put a button on your site and test the whole system.
The final step of this process is actually adding the buttons to your site that the customers will click to join your members area. This is done by using the NETbilling Form Maker to create code, then pasting it into a web page on your web site.
A SIGNUP is a single-term membership with no recurring billing periods. Generally used for 1-month membership that do not renew.
A SIGNUP+REBILLING is a membership that renews itself automatically using NETbilling's recurring billing feature. This is generally used for 1-month memberships that will renew each month until you stop them.
MEMBERSHIP VALID FOR should be in number of days. For example, one month is 30 days, and 3 months is 90 days.
REBILING AMOUNT should be how much to rebill the customer. If you are offering a free trial membership, for 3 days, as an example, you should set the TRANSACTION TYPE above to PREAUTH (AUTHORIZE ONLY). Set the PRICE option to $1.00, and set MEMBERSHIP VALID FOR to 3 days. Finally, set the REBILLING AMOUNT for the full amount they will be billed for a full-price membership.
REBILLING PERIOD should be how long between rebillings. Choose one from the popup menu, or enter a custom number of days in the box.
REBILLING COUNT should be the number of periods that the rebilling should happen. For example, a year long membership rebilled each month would enter the number 11. The first is the initial transaction, followed by 11 more months. If the membership is going to be indefinite, leave the box blank.
Next to OPTIONS, the box PRORATE FIRST PERIOD should be checked if you have want to prorate you initial signup so that all your company's rebilling can then fall on the same day of the month.