carsonk Posted August 19, 2010 Share Posted August 19, 2010 Hello, Is there a function to make a PHP file explicitly to be used as an include only? Or would it just be easier to set a variable in the parent page and test for it in the include page? I just wanted to make sure there wasn't a more efficient way than using the latter method. Thanks, Carson Link to comment https://forums.phpfreaks.com/topic/211139-explicity-make-file-for-include-only/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 19, 2010 Share Posted August 19, 2010 // detect direct access to included/required file if(strtolower(basename($_SERVER["SCRIPT_NAME"])) == strtolower(basename(__FILE__))){ exit('No Direct Access'); }/code] Link to comment https://forums.phpfreaks.com/topic/211139-explicity-make-file-for-include-only/#findComment-1101090 Share on other sites More sharing options...
carsonk Posted August 19, 2010 Author Share Posted August 19, 2010 Thank you. That was exactly what I was looking for. Link to comment https://forums.phpfreaks.com/topic/211139-explicity-make-file-for-include-only/#findComment-1101092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.