I shouldn't be in such a hurry. On review, use file_get_contents($file).

The point is to put the actual file in a directory that is not web accessible directly. This prevents people from guessing at the filename and pulling in your unprotected private information.

I'm not positive, but you'll probably have to set the headers to set it as an attachment and the mime-type pdf.

- Brian


Brian Dailey wrote:
Feed it through a PHP page.

Something like:

<?php
    if ($_SESSION['Auth'] === true) {
        // set headers?
        fread('/not/web/accessible/dir/file.pdf');
    } else {
        echo 'Denied, foo.';
    }
?>

Nicholas Hart wrote:

Hi,

Anyone know a simple way to read-protect a file/library via a php login? I have a login page which starts a session but there are certain dynamically created result files which I need to protect from potential prying eyes.

For example, you can connect to https://www.mptf.org:75/docs/TF2.pdf but I want to find a way to test your login status before permitting you to view this file. Let me know what you think. Thanks!

Regards,
Nicholas Hart




_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php



_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

--

Thanks!
- Brian Dailey
Software Developer
New York, NY
www.dailytechnology.net
begin:vcard
fn:Brian Dailey
n:Dailey;Brian
org:;Department of Geekery
adr;dom:;;;New York;NY
email;internet:[EMAIL PROTECTED]
title:Senior Software Engineer
tel;home:423 506 0349
x-mozilla-html:FALSE
url:http://dailytechnology.net
version:2.1
end:vcard

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to