Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTACCESS

Status
Not open for further replies.

musa10

Technical User
Apr 7, 2005
26
US
Hello everyone,
I use aMember as my membership program, its a PHP script. The PHP scripts link to an HTML templates. For example my member.php resides in and the template is in
Well I want to protect templates so they wont be exposed to the public. So I used htaccess and It protected it, the problem is that my images folder resides in TEMPLATES. When I protect the folder TEMPLATES, I had broken images all over my site.. So what can I do so IMAGES folder wont be protected?
Thanks
 
There's nothing you can do with .htaccess
Once you cut off the access from a higher level all subfolders will be inaccessible.
A possible solution is that you put a rewrite rule in which prohibits the reading of .html files by rewriting it to soemthing else...
However, what damage could there be in exposing the templates?


 
Actually, This can be a PHP question instead of an Apache question as all he'd have to do is create a script to use fpassthru to send the images. Just make sure that you correctly check the variables you pass to the script as you don't want people being able to use directory transversal tecniques against your website reading everything on your site.
 
Hello Matt
I am a newbie, so how would you create a script with fpassthru? I did a search on google but it doesnt seem so popular, didnt find anything that would help.. Thanks
 
So what can I do so IMAGES folder wont be protected?

One obvious answer would be to move your images folder so it's not under TEMPLATE. Download a good search/replace utility like Xchange ( to change all your references enmasse.

Mike Krausnick
Dublin, California
 
musa10,
Read up on php.net about these commands;
fopen()
fpassthru()
fclose()
header()
After reading up on those the rest should fall into place. Small hint though, you'll be using html code like this:
Code:
<img src="mylinkscript.php?picture=mypicture.jpg" />
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top