Jump to content

Archived

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

bltesar

using PHP to authenticate password protected files/folders

Recommended Posts

My server administration allows me to password protect files and folders.  When attempts are made to access the protected files, a dialogue window opens requesting username and password.  Can anyone tell me if it is possible, using PHP, to gain access to these protected files without the dialogue window opening?

Share this post


Link to post
Share on other sites
You can access these files with PHPs file functions, by using file_get_contents, or if they are php scripts use include/require. PHP doesnt send requests through the server to access the files, but the OS, so it wont trigger the authentication dialog box.

Share this post


Link to post
Share on other sites
Perhaps it would help if I gave a particular example. 

I have a folder that holds images, and access to that folder requires authentication.  When I create a page that contains images from this folder and I access the page, a pop-up validataion box opens up. 

Rather than assign a username/password via server admin for each user, I want to have only one username/password and I'm wondering if there is a way to submit this username/password behind the scenes with PHP.

The reason for this is that I want users to gain access by registering and creating their own username password and all the validation to be done using PHP/MySQL, but I also want server level authentication to block the images from the general public.

Share this post


Link to post
Share on other sites

×

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.