Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

Crypt to htpasswd

Code Wizard, 12-30-2006

This simple password crypt script will create a .htaccess and .htpasswd to password protect your directories. All you need to do is copy the code, save the file, chmod the directory your going to protect to 777, run the script, and your dirctory is password protected.

<?
/*Crypt Password script
Created on: April 1, 2001
Copyright© 123 Make Me! All Rights Reserved.
To get this script, goto http://123-makeme.com

This Software is free and can be modified and redistributed
under the condition that the copyright and information above
stays intact and with the script.*/
if(isset($pass)){
$input1="AuthUserFile $loc.htpasswd
AuthGroupFile /dev/null
AuthName "Private"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>";
$crypass=crypt($pass);
$input2="$user:$crypass";
$fp=fopen($loc.".htaccess","a+");
fwrite($fp,$input1);
fclose($fp);
$fp2=fopen($loc.".htpasswd","a+");
fwrite($fp2,$input2);
fclose($fp2);
echo "$loc is now password protected!";
}
echo "<FORM action="$PHP_SELF" method="post">
<table bgcolor="#000000">
<tr>
<td colspan="3">
Crypt Password to .htpasswd
</td>
</tr>
<tr>
<td bgcolor="#CCCCCC">
Password to Crypt:
</td>
<td bgcolor="#CCCCCC">
<INPUT type="text" name="pass" value="$pass">
</td>
</tr>
<tr>
<td bgcolor="#CCCCCC">
Username:
</td>
<td bgcolor="#CCCCCC">
<INPUT type="text" name="user" value="$user">
</td>
</tr>
<tr>
<td bgcolor="#CCCCCC">
Location of .htaccess and .htpasswd file<BR>
<font size="2">Note: Directory must be chmod 777! Also, put a trailing / on the end.</font>
</td>
<td bgcolor="#CCCCCC">
<INPUT type="text" name="loc" value="$loc">
</td>
<td bgcolor="#CCCCCC">
<INPUT type="Submit" value="Crypt!">
</td>
</tr>
</table>
Script created by <A HREF="http://123-makeme.com">123 Make Me!</A>
</FORM>";
?>
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions