note 29647 deleted from function.crypt by aidan
| From: | aidan@php.net | Date: | Mon, 05 Jul 2004 10:27:55 +0000 |
| Subject: | note 29647 deleted from function.crypt by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72584@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster@futuresign.com
----
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>