Re: protected Images without using htaccess

From: Date: Fri, 22 Jun 2001 15:31:59 +0000
Subject: Re: protected Images without using htaccess
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-54890@lists.php.net to get a copy of this message
added the wrong script... arghh... <?php Header("Content-type: image/gif"); $fp = @fopen($img,"rb"); fpassthru($fp); fclose($fp); ?> ""Fredrik Arild Takle"" <ftakle@online.no> wrote in message news:9gvl19$er6$1@w153.z064000151.sjc-ca.dsl.cnc.net... > 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 > > > > > > -- > 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 >

« previous php.general (#54890) next »