Re: protected Images without using htaccess
| From: | Fredrik Arild Takle | Date: | Fri, 22 Jun 2001 14:39:09 +0000 |
| Subject: | Re: protected Images without using htaccess | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54882@lists.php.net to get a copy of this message | ||
1. Authenticate user
2. Put the pictures in a "secret" folder or outside http_root
3. Do this:
<?php
header("Content-Type: application/download\n");
header("Content-Disposition: filename=\"$file\"");
$fn = fopen("$file" , "r");
fpassthru($fn);
?>
I hope this helps!
Fredrik A. Takle
fredrik@iPortal1.com
www.iportal1.com
""Arash Dejkam"" <arashdejkam@yahoo.com> wrote in message
news:9gvk5g$8o0$1@w153.z064000151.sjc-ca.dsl.cnc.net...
> Hi,
>
> I'm going to make a page in which users (being authenticated by PHP
session
> management) upload pictures and specify which other users can see those
> pictures, and I want all the process be automated, and I don't want to use
> Apache protection on directories, now I have a problem: if I store images
in
> a directory which is in root directory
> of HTTP server, then any user can access any image by sending a direct
> query from his browser like :
> www.mysite.com/members/images/img023.jpg even if he is not allowed. and
also
> I can not save image out of HTTP root directory because then http can not
> serve them.
> I found a very foolish solution for this :) I can store the images out of
> HTTP root dir and then use a PHP script which first checks the session ID
> and then sends the images with ImageCreateFromJPEG() and ImageJPEG()
> functions.
>
> Can anybody give me a better way to solve this problem ?
>
> Thanks
> Arash Dejkam
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>