...

View Full Version : Simple private section of my website



flexillu
06-07-2011, 03:34 PM
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?

gvre
06-08-2011, 12:09 AM
Add http authentication.
OR
Make a php file that "pushes" the file to browser for authenticated users only.
For example.


$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).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum