ballouta Posted July 12, 2008 Share Posted July 12, 2008 Hello How can I allow only registered members to downoad a file (PDF) while only visitors or those who know the link and not logged in can NOT download this file. thanks Link to comment https://forums.phpfreaks.com/topic/114396-only-members-can-download-a-file/ Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 store your pdf file names in database and add force download.... check for session while downloading whether they are member if they are then proceed with download else redirect them to login page.. if($isMember){ // download pdf file retrieved from database } else { // redirect them to some other place or any error message that you not allowed to view this } Link to comment https://forums.phpfreaks.com/topic/114396-only-members-can-download-a-file/#findComment-588273 Share on other sites More sharing options...
Jeigh Posted July 12, 2008 Share Posted July 12, 2008 I'm attempting to solve a similar problem and with the above code I don't think it will work that way he wants. If people attempt to download it through the site by clicking a link or whatever that will work, but if they just guess the file name, or somebody tells them the file name they can just type: http://www.example.com/files/filename.pdf in their browser and it will allow them to download it. Link to comment https://forums.phpfreaks.com/topic/114396-only-members-can-download-a-file/#findComment-588277 Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 you can restrict files folder by .htaccess file Link to comment https://forums.phpfreaks.com/topic/114396-only-members-can-download-a-file/#findComment-588279 Share on other sites More sharing options...
Jeigh Posted July 12, 2008 Share Posted July 12, 2008 Wouldn't using a .htaccess file require people who are logged in to enter another username and password when they are accessing the file? If not how is this achieved? Link to comment https://forums.phpfreaks.com/topic/114396-only-members-can-download-a-file/#findComment-588282 Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 this restriction will be imposed by webserver(apache) to protect files directory from public view.... Link to comment https://forums.phpfreaks.com/topic/114396-only-members-can-download-a-file/#findComment-588289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.