Re: Do people still use the .inc extension?



Guillaume wrote:
Mason Barge a écrit :

Okay. I generally put a header.inc.php file below the webroot. It would actually be a major inconvenience not to do so.

To be safe, you can add some checks, I personnaly apply the one used in phpBB :
DEFINE('IN_MYSITE', true);
in the php pages.

if (!defined('IN_MYSITE')) {
die("Hacking attempt");
}
in the php includes.
This way no .inc.php can be executed, it dies immediately.


Which isn't required if you have the include files below webroot. It also isn't required if the include file contains only functions which are called from other code (which makes the include source-file independent, BTW).

I don't really follow your reasoning (not your fault). Is there a realistic chance of harm?

if your file does some code depending on a context, which context doesn't exist if you call that file directly, yes. Such code would be extremely weird to do I think, still some people may code that way.

Regards,

Actually, the execution of the code would be quite predictable, and, if properly coded, should fail anyway if a required variable, etc. is missing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

.



Relevant Pages

  • Re: Do people still use the .inc extension?
    ... would actually be a major inconvenience not to do so. ... To be safe, you can add some checks, I personnaly apply the one used in phpBB: ... in the php includes. ... if your file does some code depending on a context, which context doesn't exist if you call that file directly, yes. ...
    (comp.lang.php)
  • Re: [patch 00/11] ANNOUNCE: "Syslets", generic asynchronous system call support
    ... properly separating the user execution context from the kernel execution ... What about TLS related kernel ...
    (Linux-Kernel)
  • Re: PHPMailer - False Positives
    ... My problem is that the PHPMailer action is returning a "true" result ... Initially the script created a new object for each email (sending them ... each execution), but the fault was evident in each configuration. ... PHP Classes - Free ready to use OOP components written in PHP ...
    (comp.lang.php)
  • Re: PHP compiler
    ... A program that compiles PHP code to executable ... language. ... more or less you can find interface to ... least better fit execution model to your desires. ...
    (alt.php)
  • Re: PHP compiler
    ... A program that compiles PHP code to executable ... language. ... more or less you can find interface to ... least better fit execution model to your desires. ...
    (comp.lang.php)