General purpose registration and login programs

demo

Read this entire document for the description, usage, features, and installation instructions for use of these programs. The source code is available here, but be warned that development is in progress. Please indicate unoffical and official versions (i.e., versions not released by me and versions released by me) by prefixing a `U' or an 'O' before the version number. I'd appreciate it if you could notify me of any modifications you may make so I can incorporate them into the official version. You, the user, are responsible for everything the program does.


Description

The registration and login programs will let you maintain a database of users that can access a particular directory. The programs work by the means of HTTP-based user authentication. If you're not familiar with HTTP-based user authentication, before you do anything, it is imperative you read some documentation on this (see the section on basic password authentication). These programs assume you have a working knowledge of user authentication.


Usage

The general purpose registraion and login programs support the following commands and features. For the purposes of this example, the CGI scripts are assumed to be named register, and modify. Literal characters (i.e., characters you should type in as is) are indicated in a fixed-width font. Variable characters are in italics. See the source code of the demo pages for real uses of program.

register in POST mode
register can only be used in POST mode to add a new user profile to the profile database, and to add a new entry in the htpasswd and htgroup files.
modify in GET mode
This will use the REMOTE_USER environment variable to pull up the profile of the username to modify and display a form where modification (or deletion) can be accomplished.
modify in POST mode
You shouldn't have to ever do this manually, as calling modify in GET mode will automatically set things up, but this is how information in the profile database is modified or deleted. Again, this relies on the REMOTE_USER environment variable being present.

Before you can use the programs, you need to set things up so you have a valid htpasswd, htgroup, and htaccess files, along with a valid profile database file. The setup script does this for you. It also serves as a handy tutorial on how to set up basic by-password user-authentication, so make sure you read it and understand how it works.

The default profile database file is very simple. You probably should tailor it to your needs. The way it works is explained in the setup script, but essentially the first line (which is a comment, prefixed by a "#") reads

# N name1|name2|name3|name4|...|nameN|

where N is the number of fields, and name1..nameN are the names of the fields. These names will be used by the modify program to generate a form with those names. The default is:

# 7 Username|E-mail|Street|City|State|Zip|Country|

Features

There are no bugs. Here is a list of caveats and features you should be aware (beware?) of.


Installation instructions

To install the program, you need a C compiler. Edit the defines in cgi_defines.h and login_defines.h (explained in detail there) and the Makefile appropriately, and type in `make' at the prompt; it should install without a fuss (at least on an Unix system). The programs generally are referred to as register and modify. This is configurable in the Makefile.

There's a small script called setup in the src directory that will help you set up by-passwd user authentication for a particular directory. It's nothing fancy, but it'll do the job. Modify it to fit your needs and run it on your server.


Ramdom access || Ram Samudrala || me@ram.org