Using Linux 7.2/PHP 4/Apache. I'm using the following code snippet to
process the POST of a form that sends $UserID and $Password:
<?php
$CryptPassword = md5($Password); \\encrypt the password
$TheFile = "/path/.htpasswd"; \\Set the file name/path
$Data = "$UserID:$CryptPassword\n\r"; \\ Setting the data stream for
the write
$FilePointer = fopen($TheFile, "a"); \\open the file
fwrite($FilePointer, $Data); \\write the data stream
fclose ($FilePointer); \\close the file
?>
to write to .htpasswd with the following format/layout:
userid:passwd
userid:passwd
userid:passwd
userid:passwd
userid:passwd
However, the data appears in the file without the carriage return or new
lines in the file as follows:
userid:passwd userid:passwd userid:passwd userid:passwd userid:passwd
userid:passwd userid:passwd
How can I write the carriage returns to the file so that they show up via
vi or via windows notepad?
ALSO, will Apache and .htpasswd deal with md5() passwords, or do I need to
limit myself to the crypt() function?
TIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]