Re: Re[2]: [PHP] check if a file is included

2008-09-16 Thread Diogo Neves
On Tue, Sep 16, 2008 at 3:09 AM, ANR Daemon [EMAIL PROTECTED] wrote: Greetings, Jochem Maas. In reply to Your message dated Tuesday, September 16, 2008, 3:38:44, ANR Daemon schreef: Greetings, Jochem Maas. In reply to Your message dated Friday, September 12, 2008, 17:05:58, I like my

Re: [PHP] check if a file is included

2008-09-13 Thread Richard Heyes
Please stop top-posting. Lest you be smitten with a vengeance reserved only for top-posters. A nasty one. :-) -- Richard Heyes HTML5 Graphing for IE7, FF, Chrome, Opera and Safari: http://www.phpguru.org/RGraph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] check if a file is included

2008-09-13 Thread Eric Butera
On Sat, Sep 13, 2008 at 2:16 PM, Richard Heyes [EMAIL PROTECTED] wrote: Please stop top-posting. Lest you be smitten with a vengeance reserved only for top-posters. A nasty one. :-) -- Richard Heyes HTML5 Graphing for IE7, FF, Chrome, Opera and Safari: http://www.phpguru.org/RGraph It

[PHP] check if a file is included

2008-09-12 Thread clive
I have a file called interceptor.php, which I would like to make use of in two ways 1. either call it directly from the browser or 2. included from another file I know I could use something like this to see if it was called via a url like http://www.site.com/interceptor.php : if

Re: [PHP] check if a file is included

2008-09-12 Thread Richard Heyes
but I would like to know if there is a neater, cleaner, sparkly way of doing this. The way your doing it is fine. You could wrap it up in a custom function, eg: // True means called directly. function wasThisFileIncludedOrCalledDirectly () { return strstr($__SERVER[REQUEST_URI],

Re: [PHP] check if a file is included

2008-09-12 Thread clive
actually $_SERVER[script_name] is probably better if not being used from a webserver. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] check if a file is included

2008-09-12 Thread Jochem Maas
clive schreef: actually $_SERVER[script_name] is probably better if not being used from a webserver. you didn't mention wanting to use the cmdline. untested code follows: ?php function indirectCall($s) { if (php_sapi_name() == 'cli') { return strstr($s, $argv[0])

Re: [PHP] check if a file is included

2008-09-12 Thread tedd
At 2:44 PM +0200 9/12/08, clive wrote: I have a file called interceptor.php, which I would like to make use of in two ways 1. either call it directly from the browser or 2. included from another file I know I could use something like this to see if it was called via a url like

Re: [PHP] check if a file is included

2008-09-12 Thread Eric Butera
On Fri, Sep 12, 2008 at 8:44 AM, clive [EMAIL PROTECTED] wrote: I have a file called interceptor.php, which I would like to make use of in two ways 1. either call it directly from the browser or 2. included from another file I know I could use something like this to see if it was called

Re: [PHP] check if a file is included

2008-09-12 Thread Eric Butera
On Fri, Sep 12, 2008 at 7:41 PM, Ashley Sheridan [EMAIL PROTECTED] wrote: Could you not check one of the variables in the $_SERVER array to determine if the script called by the browser is the current file? -- Forwarded message -- To: clive [EMAIL PROTECTED] 2. included from