Re: Preventing Access to Private Files
| From: | mike | Date: | Thu, 06 Sep 2007 20:09:42 +0000 |
| Subject: | Re: Preventing Access to Private Files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261795@lists.php.net to get a copy of this message | ||
On 9/6/07, Stephen <stephen-d@rogers.com> wrote:
> I understand how to use PHP with MySQL to have a
> members table to validate passwords. And to limit the
> generation of "member" pages to members only.
>
> But what about photographs? If someone knows the
> complete URL they could view it directly, unless the
> directory is protected using .htpassword
>
> But I don't want to have passwords in two places, nor
> muck with the password file everytime a new member
> joins.
you could use a PHP wrapper file, and do something like:
if(is logged in and has rights) {
passthru('file.jpg')
} else {
header("location: somewhere else");
exit();
}