Jump to content

password protect a whole directory..


Dragen

Recommended Posts

Hi,

I was just wondering.. I've got a login script, but to use it I have to add a snippet of code to each page I want protected by the login.

Is it possible to use php to protect a whole directory, without having to add the code to each file?

I'm presuming I would somehow use the .htaccess file...

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/49119-password-protect-a-whole-directory/
Share on other sites

.htaccess with .htpasswd would work.

 

If you wanted PHP to handle the authentication than use .htaccess with mod re-write to re-direct any call to that directory to a "process.php" file which can look at the DIR being called and than do a user check at which point if valid, it includes the requested file from the directory.

thanks.

To be honest I've never used htpasswd before.. I've just googled some stuff and found this quote:

In the htpasswd file, you place the username and password (which is encrypted).... the htpasswd file would look like this:

wsabstract:y4E7Ep8e7EYV

 

What type of encryption is it?? It doesn't explain anywhere about the type of encryption.. I would've presumed md5, but I'm sure md5 is 32 characters long...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.