By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,347 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,347 IT Pros & Developers. It's quick & easy.

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

P: n/a
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";?>
Feb 16 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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´
Feb 16 '08 #2

P: n/a
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.
js*******@attglobal.net
==================

Feb 16 '08 #3

P: n/a
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´
Feb 16 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.