Jump to content


Photo

using PHP to authenticate password protected files/folders


  • Please log in to reply
2 replies to this topic

#1 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 28 July 2006 - 12:00 PM

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?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 July 2006 - 12:09 PM

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.

#3 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 28 July 2006 - 02:35 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users