Protecting Files On Website

Discussion in 'PHP' started by primeelite, Oct 10, 2007.

  1. #1
    I have a digital music distribution service in which we give music to radio stations and DJ's, Press, Etc. I was wondering if there is a way I can protect the .mp3 files so that people cannot download them other then people on the message board (phpbb) that they are on
     
    primeelite, Oct 10, 2007 IP
  2. primeelite

    primeelite Peon

    Messages:
    1,825
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If not protecting files then if you have info on how I can track where these links were downloaded from would also appreciate help on that we are just looking for ways to make sure these music files are only downloaded on our website for legal reasons
     
    primeelite, Oct 10, 2007 IP
  3. scriptillusion

    scriptillusion Peon

    Messages:
    3,229
    Likes Received:
    129
    Best Answers:
    0
    Trophy Points:
    0
    #3
    scriptillusion, Oct 10, 2007 IP
  4. primeelite

    primeelite Peon

    Messages:
    1,825
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #4
    or if there is a way to hide where the direct link is coming from so people cannot post the link onto other websites is what I am wanting
     
    primeelite, Oct 10, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    You can use readfile() to read the file from a secret directory, and output it via your script, so the original URL would be unknown.

    
    <?php
    
    readfile('Path/to/file.mp3');
    
    ?>
    
    PHP:
     
    nico_swd, Oct 11, 2007 IP
  6. CHwebs

    CHwebs Guest

    Messages:
    94
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    put all mp3 files in a folder below your web root directory (e.g. below public_html) then serve the files through PHP

    this way you can make sure that only authenticated users can access the files, since there is no direct link available so the user will have to go through PHP to get it/them.

    You could probably track IP addresses etc through PHP too.
     
    CHwebs, Oct 11, 2007 IP
  7. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This is great. I wondered this myself, thanks :)
     
    Noddegamra, Oct 11, 2007 IP
  8. primeelite

    primeelite Peon

    Messages:
    1,825
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #8
    so how do i set this up do i need a certain script?
     
    primeelite, Oct 11, 2007 IP
  9. primeelite

    primeelite Peon

    Messages:
    1,825
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #9
    even I saw a website using a redirect which would work but dont know how to do this since I am posting the music using a modified phpbb forum and cant post php coding into the posts
     
    primeelite, Oct 11, 2007 IP