I have a web page that has many php files in it and I was wondering how can I stop users from viewing the php includes individually?
One popular way is to define a constant in the including file:
define ("INCLUDE_OK", true);
and then to check in every sub-include:
if (!defined("INCLUDE_OK")) die ("This file can't be executed directly");
Alternatively, as @mikerobi says in his now deleted answer, store the include files in a folder outside the web root.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With