Allowing user downloads...htaccess deny (override?)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boringpersonality
Forum Newbie
Posts: 1
Joined: Fri Jul 23, 2010 10:50 pm

Allowing user downloads...htaccess deny (override?)

Post by boringpersonality »

I just created my own stock website for my illustrations. I've just brought the whole thing to completion and solved EVERY problem with my own research. Now that I'm so close to the finish line, and have been working for over a month on this thing, I'm going to post this question since its officially my last problem, and then I'm going to walk away from the computer and take my wife out to eat.

That being said, DO NOT tell me I could have found it on google with a simple search :D. I want this answer spoon fed to me because having solved all of my own problems I deserve this!

All joking aside, here's the prob:



--- the problem ---

Allowing user access to a downloaded file after purchase.

Simply stated, I have a folder which includes ALL images available, in bloggie, small, medium and large size. .htaccess denies access to all of them except the watermark previews and thumbnail versions for search results.

Code: Select all

<FilesMatch "[0-9]*(medium|bloggie|small)\.(jpg|eps|png)|[0-9]{4}.(jpg|eps|png)">

Order Deny,Allow

Allow from localhost

Deny from All

</FilesMatch>
When the user purchases a file, they should be allowed access through their user area for a an amount of time (possibly perminant, I haven't decided yet).

I'm looking for any ideas that give a simple solution. If it involves fetching permissions from the mysql database, using apache functions, or simple php tricks, I'd love to know it! I just don't want to re-write files or alter anything.

Thanks guys. Off to bubba-gump!

Leo
Gargoyle
Forum Contributor
Posts: 130
Joined: Wed Jul 14, 2010 12:25 am

Re: Allowing user downloads...htaccess deny (override?)

Post by Gargoyle »

there are several ways of doing this, the most common one is to first limit folder access to everyone except localhost and then read and output the file in question through PHP

code examples can be found here:
http://www.thelampblog.com/2010/01/08/p ... fic-users/
Post Reply