ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to do download authentication in EE?

July 04, 2007 4:11pm

Subscribe [3]
  • #1 / Jul 04, 2007 4:11pm

    jliu

    1 posts

    I am new to EE and web developing. I need to implememt a website which will provide file downloading to certain users. Say when a user logged in, he can download the files belong to him. Can anybody give me a clue? I need it to be secure. Any help would be great! Thanks!

  • #2 / Jul 04, 2007 5:00pm

    jliu

    1 posts

    Hi, I know there are lots of posts related to download lock.

    But most of there only concerned registered members and group. My problem is how do I restrict a logged in user to files only belong to himself. Thanks!

  • #3 / Jul 04, 2007 6:58pm

    Mark Bowen

    12637 posts

    Hi Jliu,

    This is something that I have had to create for a site that I designed that is running EE. What I needed was a way to have (in my case) songs for teaching children in schools their subjects and each song has many files associated with it such as mp3 files, pdf files or music scores and so on and so forth. To do this I first of all had to have people pay for the songs which I handled by utilising the excellent Mals E-Commerce shopping cart to allow the user to add items to a cart. The person needs to be logged in first so they have to create an EE user account first before the buy now links appear so that I can grab their user ID to use to store so that I know what they have purchased. Once they have paid using Mals-E then it calls a hidden script on my server and adds them to table that I created to store the persons EE user ID and the id of the song (EE entry) that they had purchased. This information could then be used in a downloads section to only bring back the items that the person has access to.

    I couldn’t use the Simple Commerce module for this as, well, the site is certainly not simple as each song (entry) can be purchased in many different ‘formats’ as in a teacher gets more files than a parent for instance so this needed to be catered for also and I didn’t want to go creating loads of duplicate songs (entries) to handle this but this is pretty much what I did to handle that part.

    I then used Linklok URL to handle the secure downloads so that the user couldn’t possibly find out where the files are stored and guess at file names. It also allows me to IP lock the links to their computer so that they can’t pass on the links and also apply a time limit to when they must download the files.

    Phew…

    It was quite a bit of customisation and a lot of work but well worth it in the end as using EE made it exceptionally robust.

    This is just the way that I did it though and I’m sure that once the full EE commerce module comes out then a lot of this should be a whole lot easier, hopefully!!

    Hope that helps though for the meantime.

    Best wishes and good luck with it all.

    Mark

  • #4 / Jul 04, 2007 9:57pm

    Jhl

    1 posts

    Mark, thanks a lot for your help. I will try this implementation.

  • #5 / Jul 05, 2007 7:55am

    Mark Bowen

    12637 posts

    Hi Jhl,

    No problems. Hope you get it all working the way you need. It took me quite a while to get it all working flawlessly but it was well worth it in the end to be able to use EE as the source for all the downloads.

    Best wishes,

    Mark

    P.S. If you do look at using the linklokurl script then you will need a slightly modified version of the code so that you can include it as a php file from within EE if you go down that route. I had to contact the developers direct and they changed the script for me so that it would play nice. They did say though that if anyone has bought the script and can prove it to me then I am able to pass on the modified script so that they can have a copy of it though.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases