Jump to content

URL Security


rashmisharma

Recommended Posts

Hello!

I have a serious security issue. Suppose my site URL is http://www.abc.com

Now I have a secure admin panel folder xyz in it and ant this folder contains a subfolder where I storing the uploaded .pdf files and only after providing a valid username & password one can download these pdfs.

But if user types the direct URL in browser http://www.abc.com/xyz/pdfFolder/filename.pdf

Then he easily access that pdf without any authentication.

 

Please help me. I had searched a lot on it but don’t find any solution.

Everywhere I found .htaccess file as a solution but if I do that then I wont b able to download that file even after authentication, it says a corrupted pdf file.

 

Its Really very urgent!

Thanks for any help

 

 

Link to comment
Share on other sites

The best way is to write a delivery script in php.  All the .pdf files should be stored outside of the webroot.  Your delivery script should accept a variable like the filename to download.  It will then get the script from it's directory using one of the file opening techniques and return the contents.  You do need the script to return the proper mime header for a .pdf using the Header() function.

 

Because this is a script opening the file and returning it, the script can do a check first to insure the user has logged in.  I won't cover that, but typically it is handled through the use of php sessions.  You can set a session variable that the delivery script checks at the top, and it will give the user an error if they're not logged in, or redirect them to the login page.

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.