RE: [PHP] Fooling the client into thinking php script is .jpg

From: Date: Mon, 11 Feb 2002 18:08:18 +0000
Subject: RE: [PHP] Fooling the client into thinking php script is .jpg
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84300@lists.php.net to get a copy of this message
Wouldn't parsing every single extension of .jpg be too much? Could you just make a script and call it like this in the code? www.host.com/display.php?id=123 -----Original Message----- From: Christopher William Wesley [mailto:cwwesley@udlug.org] Sent: February 11, 2002 12:36 AM To: php-general@lists.php.net Cc: Matt Moreton Subject: Re: [PHP] Fooling the client into thinking php script is .jpg On Mon, 11 Feb 2002, Matt Moreton wrote: > I have a script that outputs an image. Using the gd library. But the ... > the image. Is it possible somehow to request the file as a .jpg? > www.host.com/displayimage.php Assuming you're using Apache, you can use a rewrite rule (with mod_rewrite). http://httpd.apache.org/docs/mod/mod_rewrite.html Turn the rewrite engine on, then specify a rewrite rule which tells apache to execute your script when a certain file is requested. Using the file names you specified, add this to your httpd.conf (or your .htaccess): RewriteEngine on RewriteRule ^/displayimage.jpg$ /displayimage.php [L] You can then just use /displayimage.jpg as an image src, then when a visitor's browser requests it, apache will execute & return /displayimage.php instead, and the visitor will never know. ~Chris /"\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.general (#84300) next »