note 29647 added to function.crypt
| From: | webmaster at futuresign dot com | Date: | Thu, 20 Feb 2003 01:44:03 +0000 |
| Subject: | note 29647 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44239@lists.php.net to get a copy of this message | ||
final code for editing the .htpasswd through two textfields (don't forget to chmod 777 the
.htpasswd):
<form method="post" action= "<?php echo
$HTTP_SERVER_VARS['PHP_SELF']; ?>">
<input type=text name=user>
<input type=text name=pass>
<input type=submit value=send>
<?php
if ($pass == "" || $user == "")
{die("please fill in all fields!");}
else {
$ht_pass = crypt($pass,substr($pass,0,2));
$file = fopen(".htpasswd","w");
fwrite($file,"$user:$ht_pass");
fclose($file);
}
?>
</form>
--
http://www.php.net/manual/en/function.crypt.php
http://master.php.net/manage/user-notes.php?action=edit+29647
http://master.php.net/manage/user-notes.php?action=delete+29647
http://master.php.net/manage/user-notes.php?action=reject+29647