August 23rd, 2000, 05:22 AM
hi, does anyone knows how to write php in a .htaccess file? coz all i want to do is to have every member his own database with his own username and password, so that only hisself can access his own directory. but my membership creation is a web-based, so that i can't create the user's own password database by hand, so it must be done when a new user is created automatically.
are there any ways to do that?
Also, I tried to use php to call htpasswd but it seemed didn't work by the script: exec("htpasswd -b -c /usr/local/apache/passwd/perry perry perry");
is that right? coz i did exactly the same in the shell and it worked in that way, only not in php script......please help....thanks a lot
August 23rd, 2000, 09:49 AM
>>all i want to do is to have every member his own database with his own username and password
Do this during the registration process and create appropriate .htaccess in user dir.
>>Also, I tried to use php to call htpasswd but it seemed didn't work by the script
Make sure "/path/to" htpasswd is in your path. So you should use /full/path/to/htpasswd" instead.
Encrypting password is not too difficult to write, you don't need to use "/usr/local/apache/bin/htpasswd" at all. Check here -> http://www.devshed.com/Talk/Forums/F...ML/000264.html to find out the Perl way to encrypt password, then do some search and convert it to PHP.