Is there a way to easily tell if a php script is being called from the command line or via web?
Thanks,
Stephen
Use $HTTP_REFERER and have the script check whether there is an IP number.
<?php if (!$HTTP_REFERER) {print 'I come from the command line, and I'm taking you with me';}
else {print "I come from the Web, and my IP is $HTTP_REFERER";}
?>
Ooops, sorry, here is the correct script:
<?php
if (!$REMOTE_ADDR) {print 'I come from the command line, and I'm taking you with me';}
else {print "I come from the Web, and my IP is $REMOTE_ADDR";}
Luciano ES Santos - SP - Brasil