Our site runs on a UNIX server so all my applications are written in PHP.
The basic "trick" I use to protect our PDF files is to put them in a location that cannot be accessed via http.
Then I have the php program read the .pdf file from that location -- after the user has been identified via userid/password.
If the user is OK, then I read the .pdf file for the user and send it to him using the php readfile statement.
I've done the same thing using .ASP /vbscript using a custom binary read .dll and the vbscript binary write command.
So, instead of linking directly to the .PDF file, you link to a program that verifies the user's credentials and then spits back the .PDF file if userid/password is OK.
I've included the PHP source code from my site.
Mike Saeger
Secretary, Northbrook
<?PHP
if ($ViewPDF == "Click To View Newtra Notes") {
$pathtofile="/home/secretlocation/";
$filename="newtranotes.pdf";
header("Content-Type: application/pdf");
readfile($pathtofile."/".$filename);
}else{
$cfgProgDir = 'phpSecurePages/';
include($cfgProgDir . "secure.php");
?>
<html>
<script LANGUAGE="JavaScript">
<!--
if (window.screen) {
var aw = screen.availWidth;
var ah = screen.availHeight;
window.moveTo(0, 0);
window.resizeTo(aw, ah);
}
// -->
</script>
<form name=pdf action="newtranotes_pdf.php" method=post>
<table width="100%">
<TR>
<TD ALIGN=CENTER>
<input type=submit name=ViewPDF value="Click To View Secret PDF File"></TD></TR></TABLE>
<?
}
?>
if ($ViewPDF == "Click To View Newtra Notes") {
$pathtofile="/home/secretlocation/";
$filename="newtranotes.pdf";
header("Content-Type: application/pdf");
readfile($pathtofile."/".$filename);
}else{
$cfgProgDir = 'phpSecurePages/';
include($cfgProgDir . "secure.php");
?>
<html>
<script LANGUAGE="JavaScript">
<!--
if (window.screen) {
var aw = screen.availWidth;
var ah = screen.availHeight;
window.moveTo(0, 0);
window.resizeTo(aw, ah);
}
// -->
</script>
<form name=pdf action="newtranotes_pdf.php" method=post>
<table width="100%">
<TR>
<TD ALIGN=CENTER>
<input type=submit name=ViewPDF value="Click To View Secret PDF File"></TD></TR></TABLE>
<?
}
?>
----- Original Message -----From: Phil RichardsSent: Saturday, November 29, 2003 3:56 PMSubject: [BbshopWebGuild] Secure PDF FilesI have successfully implemented Scott Hoge's password protected members
only page access. Now I need to know how to protect Adobe PDF files so
they can only be read by members that have signed in with a password. I
can, of course, limit access to the links to the PDF files, but the PDF
files themselves are stored in accessible locations. I don't create the
PDF files myself, so I don't know if there is a way to switch this on in
the Adobe converter. Any suggestions?
Phil Richards
Westchester Chordsmen
To unsubscribe from this group, send an email to:
bbshopwebguild-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.