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
Is all you have to do is copy this code into the page that gets included? If so, does it matter where? I assume just at the top of the code would be fine?
EDIT: Actually I just tried it and it works amazing. Thats a very handy bit of code.