Prevent downloading files if session not created

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
saifphp
Forum Newbie
Posts: 6
Joined: Tue Jul 26, 2011 4:55 am

Prevent downloading files if session not created

Post by saifphp »

Hi all,

I have an application with php5.4 and ms access2010 database. Visitor can download files from a page only if a session is created. This is managed by session variable.
Now problem is- if any visitor copy the document link an paste into a new explorer window can download that file but I want to prevent downloading file in this way also.

Can anybody guide me how to do this.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Prevent downloading files if session not created

Post by requinix »

Make sure the document can be accessed only through a PHP script. That means no redirections: your script actually outputs the file.
Post Reply