.htpasswd problem
Posted: Wed May 14, 2003 4:49 pm
Hi,
I have the following problem with my .htpasswd.
when I use the htpasswd program it works fine. I can protect my directory.
when I use php and the following code to create the .htpasswd I have an authentication failure. I guess the .htpasswd hasn't been created fine.
code:
------
$log="toto";
$pass="toto42";
$htpasswd_txt .= "$log:".crypt($pass,CRYPT_STD_DES)."\n";
$htpasswd = fopen(".htpasswd", "w");
$r = fputs($htpasswd, $htpasswd_txt);
fclose($htpasswd);
so when I have the popup for login/passwd I put toto and toto42 and I cannot access the directory.
And the log told me that it is an authentication failure:
user toto: authentication failure for "/path/to/the/file/index.htm": password mismatch
Is someone know why?
I have the following problem with my .htpasswd.
when I use the htpasswd program it works fine. I can protect my directory.
when I use php and the following code to create the .htpasswd I have an authentication failure. I guess the .htpasswd hasn't been created fine.
code:
------
$log="toto";
$pass="toto42";
$htpasswd_txt .= "$log:".crypt($pass,CRYPT_STD_DES)."\n";
$htpasswd = fopen(".htpasswd", "w");
$r = fputs($htpasswd, $htpasswd_txt);
fclose($htpasswd);
so when I have the popup for login/passwd I put toto and toto42 and I cannot access the directory.
And the log told me that it is an authentication failure:
user toto: authentication failure for "/path/to/the/file/index.htm": password mismatch
Is someone know why?