if (!isset($includedOnPage)) die();
is also concept use by many CMS including joomle... this is the best approach..
for integration with session.. i think it's the a good wishlist for dot release
oops, actually this doesn't work .... even when it is included in the page it still dies. The whole page that it is being inserted into dies.