in reply to .htaccess and cgi

If you're going to have users with different levels of access, you probably would want to put that info into a database. By using a module such as mod_auth_db, mod_auth_dbm, mod_auth_mysql, etc, Apache can get the passwords from your database for the connecting usernames and handle the authentication.

Once they have authenticated, your CGI script can access the username from the $ENV{'REMOTE_USER'} variable and then check the database to get the group/access level of that user.