Jump to content

using PHP to authenticate password protected files/folders


bltesar

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?
Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.