PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > want to get content of one php file in another php file
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
want to get content of one php file in another php file

Réponse
 
LinkBack Outils de la discussion
Vieux 16/02/2008, 10h30   #1
sarika
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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";?>
  Réponse avec citation
Vieux 16/02/2008, 19h46   #2
thib´
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: want to get content of one php file in another php file

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´
  Réponse avec citation
Vieux 16/02/2008, 20h38   #3
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: want to get content of one php file in another php file

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
==================

  Réponse avec citation
Vieux 16/02/2008, 21h41   #4
thib´
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: want to get content of one php file in another php file

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´
  Réponse avec citation
Vieux 16/02/2008, 21h46   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: want to get content of one php file in another php file

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
==================

  Réponse avec citation
Vieux 16/02/2008, 21h56   #6
thib´
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: want to get content of one php file in another php file

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h33.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15978 seconds with 14 queries