Disallow downloading of file

Discussion in 'PHP' started by khan11, Dec 26, 2008.

  1. #1
    Hello,

    I want a script to disallow my site users from downloading those files.

    Actually, i have created file.php?file=amc.mp3 for playing song in media player but when users with download managers access that page, instead of playing that mp3 their download manager directly catches that file to be downloaded.

    What i want is to disallow them from download that file, but i want to play that file on my site.


    Any solution?
     
    khan11, Dec 26, 2008 IP
  2. sojic

    sojic Active Member

    Messages:
    133
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    #2
    I think that it is impossible.

    You have to "send" file (for playing or not) to client. Nothing can stop him to download it....

    Try using flash mp3 player and "hide/mask" real locations for .mp3 file, and for security create .htaccess (hotlik protection).
     
    sojic, Dec 26, 2008 IP
  3. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #3
    well, actually the main disturbing thing is download manager.

    How if it enables user to download but their download managers doesn't catch file from media player on site?
     
    khan11, Dec 26, 2008 IP
  4. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The only thing you can do is make your PHP-script look for the client-name the browser sends, and decide whether to actually send the file or not based on that.
    It's nowhere near bulletproof, though. I can whip up a PHP-scripts in 3 minutes that downloads a page identifying itself as Internet Explorer 10000.
     
    tamen, Dec 26, 2008 IP
  5. farad

    farad Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The only way to do this is to fetch song information from db ..
    For example, user opens song.php?id=24 ! Frob db : song path, song name .. both depending on this ID ..
    User will see id=24, but you will play for example my_song.mp3 ( fetch it from db where id = get['id'] ) ..

    Hope it helps a bit .. :rolleyes:
     
    farad, Dec 26, 2008 IP
  6. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #6
    implement a special cookie and session id, download managers cannot catch those easily.
     
    Kaizoku, Dec 26, 2008 IP
  7. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #7
    thanks guys!

    i'm noob in coding stuff so can't do it, i think i should bear with it.
     
    khan11, Dec 27, 2008 IP
  8. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #8
    It can be done but you'll need to mix some PHP headers with a modification of the .htaccess file.
     
    Yesideez, Dec 27, 2008 IP
  9. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #9
    well i tried doing this stuff by setting .htaccess but it then disallowed my own site to read those files.

    I want somefin that stops other people to download files or at least block download managers from catching the link.
     
    khan11, Dec 27, 2008 IP
  10. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #10
    Best bet would be set a flag when they visit the player page, then when they request the mp3, if the flag has expired - don't send the file, otherwise send it.

    Wouldn't be 100% though, in all honesty you're wasting your time, advanced users could get around it extremely quickly whichever method is used.
     
    Danltn, Dec 27, 2008 IP
  11. no-name

    no-name Guest

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #11
    you could make a script in php that checks what browser (netscape, firefox, ie, opera...) is using the user, if the user is using one of that then send download page if not using one of that browser probably is using a downloader and then sent nothing :D
     
    no-name, Dec 27, 2008 IP
  12. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #12
    Most downloaders masquerade as a legitimate browser anyway, only the good ones (which follow things like robots.txt anyway) that don't spoof would be stopped, and even then - why would they want the file anyway?
     
    Danltn, Dec 27, 2008 IP
  13. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #13
    actually the site is about classical singer whose songs are listed on site for listening purpose only. The companies give permission only to allow people for listening of songs thats why i want to make it secure so people couldn't download the songs.

    anyways thanks for help, i will hot-link protect it and also create a page that hides the link location plus will try to disable download resume feature.
     
    khan11, Dec 27, 2008 IP