Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    how i can protect directory ?

    Hello,
    I have login system and i have music folder on my site I want protect this directory to any one want download any thing from this folder and only the members on my login system can be download it and lesten..
    so let me explain an exaple:

    if we have a directory on my host such as music..

    on dir. music we have those file:
    1.wma
    2.wma
    3.wma

    and index.php file on this dir. to check the session is set or not i mean the user are logining or not..

    so..

    how i can colse this way:
    any body try download my music file directly from path like:
    www.domain.com/music/1.wma

    any one have idea for this plan please dont hesitate to tell us about it..

    thanks..

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    There are two ways I can think of.

    1- Store all media files in a directory underneath your public_html folder....and use parameters to specify which file that a user wants to download...such as http://yoursite.com/download.php?file=meida1.wma where the download.php file would check user credentials before downloading contents.

    2- Use .htaccess mod_rewrite to force all files ending with .wma to forward to a specific page that would check credentials and then allow users to download contents etc.

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts
    hi again..
    thanks alot..
    i will try to do it leater on..
    if i have qus.

    i will come again..

    regards
    marhoons

  • #4
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    or just put index file in your directory with header redirect to your domain

    edit: misunderstood.. sry..

    use .htaccess
    Last edited by matak; 08-10-2007 at 10:43 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •