f



want to get content of one php file in another php file

i have one php file having content

Contents of ex1.php file
<body>
<?php
$content = "c://webserver/www/abc.php";
$handle = fopen($content, "r");
echo fread($handle,filesize($content));
?>
</body>
this is reading abc.php file in which i m simply using an echo
statement. When i execute ex1.php file i cant see the php statement of
abc.php file

content of abc.php file is
<?php echo "hello";?>
0
2/16/2008 10:30:02 AM
comp.lang.php 32646 articles. 0 followers. Post Follow

5 Replies
2204 Views

Similar Articles

[PageSpeed] 38

sarika wrote:
> i have one php file having content
> 
> Contents of ex1.php file
> <body>
> <?php
> $content = "c://webserver/www/abc.php";
> $handle = fopen($content, "r");
> echo fread($handle,filesize($content));
> ?>
> </body>
> this is reading abc.php file in which i m simply using an echo
> statement. When i execute ex1.php file i cant see the php statement of
> abc.php file
> 
> content of abc.php file is
> <?php echo "hello";?>

That's interesting, I've found out that it's the browser that's hiding <?php 
?> tags within .phpx pages. Probably to avoid short tags scripts (on a 
server that doesn't allow them) from getting leaked by visitors who don't 
know about this browser trick, until the dev' realizes his error.

Not a good thing, IMO; dev's should take care, themselves, and it's still 
not secure since the hidden string is still in the rendered source. And now 
we don't know how to escape this one. Do we?

-thib�
0
thyb0 (37)
2/16/2008 7:46:09 PM
thib� wrote:
> sarika wrote:
>> i have one php file having content
>>
>> Contents of ex1.php file
>> <body>
>> <?php
>> $content = "c://webserver/www/abc.php";
>> $handle = fopen($content, "r");
>> echo fread($handle,filesize($content));
>> ?>
>> </body>
>> this is reading abc.php file in which i m simply using an echo
>> statement. When i execute ex1.php file i cant see the php statement of
>> abc.php file
>>
>> content of abc.php file is
>> <?php echo "hello";?>
> 
> That's interesting, I've found out that it's the browser that's hiding 
> <?php ?> tags within .phpx pages. Probably to avoid short tags scripts 
> (on a server that doesn't allow them) from getting leaked by visitors 
> who don't know about this browser trick, until the dev' realizes his error.
> 
> Not a good thing, IMO; dev's should take care, themselves, and it's 
> still not secure since the hidden string is still in the rendered 
> source. And now we don't know how to escape this one. Do we?
> 
> -thib�
> 

This is normal operation.  The interpreter does not parse files read 
with fread().  If you just want to include them in the script, include 
or require them.

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

0
jstucklex (14659)
2/16/2008 8:38:51 PM
Jerry Stuckle wrote:
> thib� wrote:
>> sarika wrote:
>>> i have one php file having content
>>>
>>> Contents of ex1.php file
>>> <body>
>>> <?php
>>> $content = "c://webserver/www/abc.php";
>>> $handle = fopen($content, "r");
>>> echo fread($handle,filesize($content));
>>> ?>
>>> </body>
>>> this is reading abc.php file in which i m simply using an echo
>>> statement. When i execute ex1.php file i cant see the php statement of
>>> abc.php file
>>>
>>> content of abc.php file is
>>> <?php echo "hello";?>
>>
>> That's interesting, I've found out that it's the browser that's hiding 
>> <?php ?> tags within .phpx pages. Probably to avoid short tags scripts 
>> (on a server that doesn't allow them) from getting leaked by visitors 
>> who don't know about this browser trick, until the dev' realizes his 
>> error.
>>
>> Not a good thing, IMO; dev's should take care, themselves, and it's 
>> still not secure since the hidden string is still in the rendered 
>> source. And now we don't know how to escape this one. Do we?
>>
>> -thib�
>>
> 
> This is normal operation.  The interpreter does not parse files read 
> with fread().  If you just want to include them in the script, include 
> or require them.
> 

I think the purpose here is to actually output the source.
Well, we've got highlight_[file/string](), but maybe akira wants 'more'.

-thib�
0
thyb0 (37)
2/16/2008 9:41:54 PM
thib� wrote:
> Jerry Stuckle wrote:
>> thib� wrote:
>>> sarika wrote:
>>>> i have one php file having content
>>>>
>>>> Contents of ex1.php file
>>>> <body>
>>>> <?php
>>>> $content = "c://webserver/www/abc.php";
>>>> $handle = fopen($content, "r");
>>>> echo fread($handle,filesize($content));
>>>> ?>
>>>> </body>
>>>> this is reading abc.php file in which i m simply using an echo
>>>> statement. When i execute ex1.php file i cant see the php statement of
>>>> abc.php file
>>>>
>>>> content of abc.php file is
>>>> <?php echo "hello";?>
>>>
>>> That's interesting, I've found out that it's the browser that's 
>>> hiding <?php ?> tags within .phpx pages. Probably to avoid short tags 
>>> scripts (on a server that doesn't allow them) from getting leaked by 
>>> visitors who don't know about this browser trick, until the dev' 
>>> realizes his error.
>>>
>>> Not a good thing, IMO; dev's should take care, themselves, and it's 
>>> still not secure since the hidden string is still in the rendered 
>>> source. And now we don't know how to escape this one. Do we?
>>>
>>> -thib�
>>>
>>
>> This is normal operation.  The interpreter does not parse files read 
>> with fread().  If you just want to include them in the script, include 
>> or require them.
>>
> 
> I think the purpose here is to actually output the source.
> Well, we've got highlight_[file/string](), but maybe akira wants 'more'.
> 
> -thib�
> 

OK, then you need to use html_entities() to convert the html special 
characters.

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

0
jstucklex (14659)
2/16/2008 9:46:17 PM
Jerry Stuckle wrote:
> thib� wrote:
>> Jerry Stuckle wrote:
>>> thib� wrote:
>>>> sarika wrote:
>>>>> i have one php file having content
>>>>>
>>>>> Contents of ex1.php file
>>>>> <body>
>>>>> <?php
>>>>> $content = "c://webserver/www/abc.php";
>>>>> $handle = fopen($content, "r");
>>>>> echo fread($handle,filesize($content));
>>>>> ?>
>>>>> </body>
>>>>> this is reading abc.php file in which i m simply using an echo
>>>>> statement. When i execute ex1.php file i cant see the php statement of
>>>>> abc.php file
>>>>>
>>>>> content of abc.php file is
>>>>> <?php echo "hello";?>
>>>>
>>>> That's interesting, I've found out that it's the browser that's 
>>>> hiding <?php ?> tags within .phpx pages. Probably to avoid short 
>>>> tags scripts (on a server that doesn't allow them) from getting 
>>>> leaked by visitors who don't know about this browser trick, until 
>>>> the dev' realizes his error.
>>>>
>>>> Not a good thing, IMO; dev's should take care, themselves, and it's 
>>>> still not secure since the hidden string is still in the rendered 
>>>> source. And now we don't know how to escape this one. Do we?
>>>>
>>>> -thib�
>>>>
>>>
>>> This is normal operation.  The interpreter does not parse files read 
>>> with fread().  If you just want to include them in the script, 
>>> include or require them.
>>>
>>
>> I think the purpose here is to actually output the source.
>> Well, we've got highlight_[file/string](), but maybe akira wants 'more'.
>>
>> -thib�
>>
> 
> OK, then you need to use html_entities() to convert the html special 
> characters.
> 

Ha, yep !
That was obvious..
Thanks.
0
thyb0 (37)
2/16/2008 9:56:15 PM
Reply: