| 
	
 | 
 Posted by J.O. Aho on 06/21/07 20:11 
C. wrote: 
> On 20 Jun, 12:40, Jerry Stuckle <jstuck...@attglobal.net> wrote: 
>> Tim Streater wrote: 
>>> In article <1182309379.784775.138...@q75g2000hsh.googlegroups.com>, 
>>>  Steven Borrelli <sborrel...@gmail.com> wrote: 
>>>> Hello, 
>>>> I am using the <?php include() ?> statement on my website for 
>>>> organizational purposes.  However, one of my includes contains some 
>>>> PHP code.  Is there any way for the server to actually parse the 
>>>> include?  I've tried this before, and it did not parse the include. 
>>>> Rather, it included the file as just plain ASCII. 
>>>> ======================= 
>>>> /*EXAMPLE 1*/ 
>>>> /*index.php*/ 
>>>> ... 
>>>> <?php include('global/includes/footer.inc') ?> 
>>>> ... 
>>>> /*footer.inc*/ 
>>>> ... 
>>>> <p>© 1993-<?php echo date("Y") ?> Kingswood School.  All rights 
>>>> reserved.</p> 
>>>> ... 
>>>> /*EXAMPLE 2*/ 
>>>> /*index.php*/ 
>>>> ... 
>>>> <?php include('global/includes/lastmod.php') ?> 
>>>> ... 
>>>> /*lastmod.php*/ 
>>>> ... 
>>>> <?php 
>>>>    echo "This file was last modified: "; 
>>>>    echo strftime("%A %B %d %Y"); 
>>>>    include('whateverfilename.inc'); 
>>>> ?> 
>>>> ============================= 
>>>> I would like to be able to parse the include if it has php code, and 
>>>> in some cases, create nesting includes (an include within an 
>>>> include).  Is this even possible?  Any ideas? 
>>>> Any help is certainly appreciated.  Thanks! 
>>>> Steven Borrelli 
>>>> Web Developer 
>>>> Kingswood School 
>>> Should be parsed as long as the include file has the <? and ?> tags. 
>>> Most of my includes are tagged .inc and it works fine. 
>> It depends completely on how your webserver is set up. 
>> 
>  
> Not for an includED file - the web server has no visibility of it. 
 
It's true, the file extension don't matter when you include files in a php 
file, but by default a *.inc file won't be parsed if it's directly accessed 
 
example: http://www.example.net/myincludefile.inc 
 
This can be a security issue if you store database login/passwords in a *.inc 
file, which you should avoid to use any other extention than *.php, which will 
be parsed on a php enabled server. 
 
--  
 
  //Aho
 
[Back to original message] 
 |