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 Quote 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] Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.