How would you find out whether or not a CGI file (.pl or .cgi) is being required by another file or is being executed by itself?
For example, if you had an index.cgi and it requires settings.pl for all its configuration (for example, YaBB forum does this). And so if settings.pl is accessed all by itself, it would print something out (maybe redirecting you back to index.cgi), but if index.cgi requires it, it won't print that.
What I tried so far was something like this:
Code:
if ($0 eq 'settings.pl') {<br /> print "Content-Type: text/html\r\n\r\n";<br /> print "<b>error:</b> use index.cgi instead.";<br /> exit(0);<br />}
The idea was that if index.cgi required settings.pl, $0 would equal 'index.cgi' - but $0 isn't only the file's name, it's the path on the server (like G:\www-aichaos\new\settings.pl on my local server and like /home/public_html/new/settings.pl on a remote host).
Are there any other ways to find out whether or not a file is being executed alone or from another file? _________________ Current Site (2008) http://www.cuvou.com/