I would say it's possible with http server vars, but not in the case of included files.
echoing $PHP_SELF inside of an include()'d file will give you the name of the parent file (i.e. the file that includes this file)
depending on the degree to which you need to use this you may try something like this:
file: common.inc
<?php
$strCurrFilename = "common.inc";
if (stristr($SCRIPT_NAME,$strCurrFileName))
{
//file was called directly
// ......
}
else
{
// file was included
// .....
}
?>
this is just off the top of my head, so it may not work, but hopefully it will get you thinking