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 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2010
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Simple private section of my website

    I have a simple website. I want to host a file on there that only registered users can download.

    Can someone confirm what i'd need to do to achieve this?

    Is it just a case of putting it in a directory and making that directory private?

  • #2
    Regular Coder
    Join Date
    May 2011
    Posts
    241
    Thanks
    1
    Thanked 57 Times in 56 Posts
    Add http authentication.
    OR
    Make a php file that "pushes" the file to browser for authenticated users only.
    For example.

    PHP Code:
    $id = isset($_GET['id']) ? (int)$_GET['id'] : null;
    // a better solution would use a hash instead of id
    // check that user is authenticated and file with id=$id exists
    // push file to browser with readfile() or mod_xsendfile (better solution). 


  •  

    Posting Permissions

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