Closed AlbinoGeek closed 9 years ago
Actually the entire code isn't wrapped in a if. We are using the get_included_files()
function to test if the file is being included or directly accessed and showing a 404 error if the file is being viewed directly.
The commit that has introduced this function is mine and I was using this approach on another project, so just used the snippet that I already have on the code editor. Both ways work well.
It was wrapped in an if
checking the file access constant.
Yeah, you are right. This one wasn't my fault :smile:
It doesn't really matter if someone goes directly to your config.php file, as it should never "echo" anything out to the page. However, if you must deny access to files such as this being viewed directly, consider doing this better as such:
In index.php (or the normal entry points):
In files you want to deny direct access to:
You should not wrap your entire script in an if, just bail out!