In a.php I have
include("b.php.include")
Any way to find out in b.php.include which script included me (b.php.inc)
Im not looking for $HTTP_REFERER
Thanks
Who referred to for include/require files ?
Moderator: General Moderators
Don't know the answer to your question, but calling files b.php.include will mean anyone accessing the file by going to http://www.example.com/b.php.include will see the source code.
(Unless you put the file outside the web root, or you configure the server to parse .include as something other than text.)
(Unless you put the file outside the web root, or you configure the server to parse .include as something other than text.)
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
the debug backtrace should give the info too.. I don't see much point in it either really. Only thing I can see is knowing if it's being included or not, but that can be handled in other ways...
The following has worked well for me in the past
The following has worked well for me in the past
Code: Select all
// include this function into all scripts (you wish to lock)
function no_direct_access($filename)
{
if((in_array('PATH_TRANSLATED',$_SERVER) && ($filename == $_SERVERї'PATH_TRANSLATED'])) || ($filename == realpath($_SERVERї'SCRIPT_NAME'])))
{
die("Direct access to this file is denied.");
}
}
no_direct_access(__FILE__); // when in a script you wish to lock, just call this exact line, do not change __FILE__ to anything else.