[SOLVED] Restrict a file to called only from a particular fi

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Restrict a file to called only from a particular file

Post by anjanesh »

Hello

I have a file a.php which includes an image m.jpg either using <IMG> or image function - whatever. Now I was this done in such a way that ONLY a.php has the right to include m.jpg. So if m.jog is requested from the server the server should check if the request is coming from the page a.php. I need this done so that other scripts(or html files) have a link to this image or include it.

I am sure there must be some method to do this otherwise in all our sites we could save some images space and just link some common ones to other peoples' sites or even microsoft's.

I am pretty sure this is possible because log ago when I kept linking the images in my angelfire site from my geocities page my angelfire a/c got disconnected due this reason.

Thanks
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

You don't control this from PHP, it's a server setting. Try here: http://altlab.com/htaccess_tutorial.html
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Thanks
SOLVED
Post Reply