What came accross my mind, when I read this, was, if it wasn't possible to manage such thing by using PHP?
- You register your Username and Password in a Form
- You encode the given Password by using crypt() (I think thats the Algorithm for the .htpasswd)
- You write it into .htaccess (fputs() ?)
Although, I'm not sure whether it would work to write into a .htpasswd file
To your post: I don' think you have to write anything into the .htaccess file itself. When you simply put the following lines into the .htaccess, you only have to write into the .htpasswd
Code:
AuthUserFile Link/to/your/.htpasswd/file
require valid-user