01-16-2008, 08:28 PM
|
#12 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
|
I'll give you a hint.  The script has to do with a combination of readfile(), and header()---beyond the referrer check of course. The reason we suggest you store the downloads outside the root html directory is so that no one can directly link to those files.
To take the first example from the PHP manual, and fix it a bit:
PHP Code:
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The filesize, so progress bars show up right
header('Content-length: '.filesize('original.pdf'));
// The PDF source is in original.pdf
readfile('original.pdf');
?>
Betcha already can think of how to use stuff like this.
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
|
|
|
|