#!/usr/local/bin/perl
########################################################################
# HTPASSWD Password generator and manager - Version 1.0 - 11/4/2002
# The original htpass script writen by Tony Awtrey has been modified
# by Mike Hansen of the National Federation of the Blind of Nebraska
# (http://nfbn.inebraska.com). Building on the htpasswd ver. 0.9 script
# writen by Tony Awtrey the following features and bug fixes were added.
# -- Ability to add custom headers and footers
# -- Users and Groups are know sorted Alpahbeticaly
# -- Appropriate HTML tags were added to make the forms blind friendly
# -- A bug was corrected that would prevent you from assigning a user to
# to a group that currently had no members
# -- A bug was corrected that would cause strange things to happen if the
# Admin form was refreshed through the browser
# -- Format of listings of group members was changed to better fit on a page
######################################################################
# HTPASSWD Password generator and manager - Version 0.9 - 7/13/98
# Copyright 1998 Anthony Awtrey
#
# This application is licensed under the GNU Public License.
# For more information see: http://www.gnu.org/copyleft/gpl.html
#
# This HTML will set up a form to return the correct line for an
# .htpasswd file. But Wait There's More!
#
#
#
# If you want to let it, the program will maintain the .htpasswd file
# for you. This is as secure as the .htaccess security is itself.
# (Read: Not Very Secure At All!! Do not rely on it completely!!)
# Set up a directory specifically for .htpasswd and .htgroup files.
# Include an .htaccess file to restrict access to the directory.
# Use the script and form above to get a username / passwd line for
# and add it in manually. Now, go to the URL of the script like this:
#
# http://www.domain.com/cgi-bin/htpass.cgi?admin
#
# The ?admin will cause the script to bring up a screen to allow you
# create and delete user accounts, add and remove groups and change
# group membership. The form is pretty straight-forward. If you have
# any questions on the script please go to the http://www.awtrey.com/
# website and leave a WebBoard message. I will answer any questions
# you have.
######################################################################
#Program Vars
$cgidir = "http://your.domain.com/cgi-bin/htpass";
$cgifile = "htpass.cgi";
$cgiurl = "$cgidir/$cgifile";
$htaccess_dir = "/server/path/to/directory/containing/.htpaswd/and/.htgroup";
$htpasswd_file = ".htpasswd";
$htgroup_file = ".htgroup";
###################################
#HTML Vars
$site_title = "Your Homepage";
$title = "User and Group Manager";
$stylesheet = "../style.css";
$bgcolor = "#FFFFFF";
# If you would like to use a header file set the next value to 1 and
# specify the path to the header file, other wise set it to 0.
$header = 1;
$headerpath = "/server/path/to/header_file";
# If you would like to use a footer file set the next value to 1 and
# specify the path to the footer file, other wise set it to 0.
$footer = 1;
$footerpath = "/server/path/to/footer_file";
#Do NOT Touch below this point
###################################
#Forms HTML Code.
$pw_form = qq{