Check out the header function...

You can use a mysql (or whatever) db for authentication, read the file
from a protected directory, then spit it out to the browser.

The code should look a bit like this:
// headers 
header ("Content-Disposition: filename=yourfile.pdf"); 
header ("Content-type: application/pdf"); 

// grab the template file
$filename="yourfile.pdf"; 
$fp=fopen($filename, "r"); 

//read our template into a variable 
$output=fread($fp,filesize($filename)); 
fclose($fp);

// send the data to the browser
echo $output;


Hope that helps...

        -- jon

-------------------
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557

-----Original Message-----
From: Roger B.A. Klorese [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 24, 2004 5:01 PM
To: 'Matt Hedges'; [EMAIL PROTECTED]
Subject: RE: [PHP] password protect a pdf


> I'm trying to password protect an online PDF file.  I know
> how to use PHP to
> pw protect a webpage, but what would be the best way to 
> protect access to a
> nonwebpage file?

Stick it in its own directory and use htaccess... Or password-protect it
when you generate it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to