[PHP] Detect local or remote call?

2007-10-11 Thread Anders Norrbring
Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Anders. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Detect local or remote call?

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Anders Norrbring [EMAIL PROTECTED] wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Anders maybe not the best, but works for linux: ?php if(isset($_SERVER['SHELL'])) { echo 'cli script' . PHP_EOL; } else {

Re: [PHP] Detect local or remote call?

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Marcus Mueller [EMAIL PROTECTED] wrote: Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Check out http://www.php.net/manual/en/function.php-sapi-name.php. much better:) php echo

Re: [PHP] Detect local or remote call?

2007-10-11 Thread Marcus Mueller
Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Check out http://www.php.net/manual/en/function.php-sapi-name.php. Greetings m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Detect local or remote call?

2007-10-11 Thread Robert Cummings
On Thu, 2007-10-11 at 19:58 +0200, Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? I've always used if( isset( $_SERVER['SERVER_PORT'] ) ) { return 'web'; } Cheers, Rob. --

Re: [PHP] Detect local or remote call?

2007-10-11 Thread Anders Norrbring
Nathan Nobbe skrev: On 10/11/07, *Marcus Mueller* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Check out