This script (htpasswd.inc) allows you to
The script is copyright (C) 2004,2005 by Jarno Elonen and it's licensed under the Modified BSD license (see the script comments for details).
Thanks to Jürgen Galupki for a CRYPT_SALT_LENGTH patch and Jonas Wagner for SHA1 support.
Here's how to emulate the basic .htaccess method to password protect your web site. Obviously, it's not the most useful way to employ this script, but a good example anyway.