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 http://www.site.com/interceptor.php :

if (strstr('interceptor',$__SERVER["REQUEST_URI"])) {
  // url
} else {
  //probably included
}

but I would like to know if there is a neater, cleaner, sparkly way of doing this.

Thanks

Clive

Another way.

You could define a variable ($interceptor = 0) in the main portion of your script and then populate the variable ($interceptor = 1) in the included portion and then check the value to see if it's been included or not.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to