gabe8496 Posted September 28, 2007 Share Posted September 28, 2007 I've been looking over some code and notice many use the following format (when doing and include) pagename.inc.php What effect does .inc have on a page that is included versus including a page without it? What am I missing? I did some search on web page extensions via google and couldn't find anything describing this. Any info would be greatly appreciated. Thanks, Gabe Quote Link to comment https://forums.phpfreaks.com/topic/71077-page-extensions/ Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 Nothing from what i'm aware, it'll just be a practice to indicate to others that the page is never called directly... Quote Link to comment https://forums.phpfreaks.com/topic/71077-page-extensions/#findComment-357366 Share on other sites More sharing options...
gabe8496 Posted September 28, 2007 Author Share Posted September 28, 2007 is there ways to restrict direct access to them? Quote Link to comment https://forums.phpfreaks.com/topic/71077-page-extensions/#findComment-357370 Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 Set file permissions, use '.htaccess' or use 'mod_rewrite' from with '.htaccess', put em in a folder and set folder permissions, etc... Quote Link to comment https://forums.phpfreaks.com/topic/71077-page-extensions/#findComment-357374 Share on other sites More sharing options...
GingerRobot Posted September 28, 2007 Share Posted September 28, 2007 Indeed. The only reason why people end with the extension .inc.php is to show that the file is one that will be included by others. Some people simply end with the extension .inc. However this is bad practice and a security issue, because it may lead people to be able to see the php code in plain text. As for resticting access, it may not be necessary. As long as the final extension is .php, then the page will be parsed by the php processor, so no-one would be able to see your code. If access is still an issue, then as has been suggested, you can restrict with permissions or .htaccess. Another alternative is to place the files outside of the web root folder. Quote Link to comment https://forums.phpfreaks.com/topic/71077-page-extensions/#findComment-357386 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.