.htpasswd and "crypt"
Posted on 2003-02-27
I need to write a PHP script to add and remove users from the .htpasswd file. Removing users is easy, it's the adding of users that's the hard part. For some reason, the passwords are not being written correctly.
I have downloaded a script that uses PHP's "crypt" function to generate the encypted passwords that are written to .htpasswd. But the problem is that users that are written this way are unable to log in. Of course, when I use Apache's htpasswd program to write users, everything is cool. I did notice that Apache's htpasswd ptogram uses MD5 encyption on Windows. I tried using PHP's MD5 function to generate the passwords, but this didn't work either.
Has anyone else done this on Windows? I can't believe I'm the only one who's tried this.
Thanks in advance.