PHP & Apache - How to protect downloads (such as PDFs)?
Posted: Wed May 17, 2006 12:27 pm
Hi All,
Please forgive me if this is a tired subject!
I am running php4 on apache2. I secure all pages in the site with a combination of PHP and .htaccess. Here's my code:
.htaccess:
header.php:
This works great for html docs, but what about downloads? How do I protect those?
Thanks!
Please forgive me if this is a tired subject!
I am running php4 on apache2. I secure all pages in the site with a combination of PHP and .htaccess. Here's my code:
.htaccess:
Code: Select all
AddType application/x-httpd-php .php .html
php_value auto_prepend_file /user/apache2/htdocs/include/php/header.phpCode: Select all
<?php
session_start();
$permission=$_SESSION["permission"];
if(!$permission=="yes") {
echo 'You are not allowed to access this page. Please access this page through our <a href="/index.php">Client Login Page</a>';
echo '<script language="javascript" src="/include/javascript/logon_unsuccessful.js"></script>';
}
?>Thanks!