ITT #3: Protecting Non-Public Files

If you've ever built a web app, you're probably familiar with the idea of breaking your code up into smaller pieces, then including those files using include_once or require_once. This practice can speed up your application, help you organize your code better, and increase the portability of code in future projects. Another benefit that file inclusion offers that's often overlooked, however, is enhanced security.

For example, nearly every app that I write reads to or writes from a database. To speed up the connection process, I've written a database class that I simply include in new projects, allowing me to easily open the connection and just keep on coding.

The information used in the included database file is sensitive data that could be troublesome in the wrong hands (i.e. the username and password for my database), and while... read more

  • «
  • 1
  • »