RE: [PHP] password protect a pdf

From: Date: Wed, 25 Feb 2004 00:14:54 +0000
Subject: RE: [PHP] password protect a pdf
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-178794@lists.php.net to get a copy of this message
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: jon@trafficdesigns.com phone: 888.230.7557 -----Original Message----- From: Roger B.A. Klorese [mailto:rogerk@queernet.org] Sent: Tuesday, February 24, 2004 5:01 PM To: 'Matt Hedges'; php-general@lists.php.net 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

« previous php.general (#178794) next »