![]() |
![]() |
![]() |
Home -> Online Tools -> Password Protect Directories
Password Protect Directories using .htaccess -Fill out the form below and we will automatically generate the code to go in your .htaccess and .htpasswd files.if ( isset($user) && isset($password1)) { if( $password1 == $password2 ) { $pfad = $DOCUMENT_ROOT . dirname($PHP_SELF) . "/.htpasswd"; $safe= dirname ($PHPSELF); $htaccess_text = "AuthType Basic\n". "AuthName \"\"\n". "AuthUserFile $pfad\n". "require valid-user\n"; for ($i = 0; $i < count ($user); $i++) { $htpasswd_text .= "$user[$i]:".crypt($password1[$i],CRYPT_STD_DES).""; } echo "Step by Step GuideFirst make a file called .htaccess (just start 'notepad', when you save the file call it .htaccess Nothing before the '.' Change 'Save as Type' from Text Document to All Files then click Save) put the following text in the file:AuthName \"Password Protected Directory\" AuthType Basic AuthUserFile /your/server/path/.htpasswd require valid-user Then save the file in the directory you wish to protect. You must call it .htaccess with nothing before the . Remember to change line 3 (above) to reflect the path to the directory you are going to put the next file .htpasswd file Then make a file called .htpasswd Below is the text you need to enter into your .htpasswd file, then upload both the files to the directory you want to protect! This is your username and encrypted password"; echo " "; echo nl2br($htpasswd_text); echo " Thats it try going to a page in the directory you placed the .htaccess file. You can add more than one user to a .htpasswd file. "; } else { echo " "; echo "Passwords do not match"; echo " "; } } ?> Note: We do NOT store your usernames and passwords.
|
|
| Home :: Tutorials :: Online Tools :: Services :: Contact Us :: SiteMap © WWW Security Services 2004. Part of the Live Internet Entertainments Group of Website's. |