Hi - I'm trying to check what domain/file is requesting another one. For example if I have file webstuff.com/a.php and it is pulling in file b.php is there a way for file b.php to check and make sure that it is domain webstuff.com and file a.php that are requesting it? I would like to use PHP and or javascript for this. Thanks.
You can check the name of the including file, or check if a variable declared in the including file has a value...
i would go with this too, parse it up until you get the thing you want to differentiate with other domain. you could also do a quick combination with requesting IP for more security.
HTTP_REFERER doesn't work for include files. Of the few times I've needed to do this and haven't wanted to rely on the including file to set a variable, I used the debug_backtrace function ( http://php.net/manual/en/function.debug-backtrace.php ) and just moved my way back up the trace until I found the include function call.
If a.php is including b.php: In b.php, $_SERVER['PHP_SELF'] will be a.php, and __FILE__ will be b.php. That might help.