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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sarika

    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,f ilesize($conten t));
    ?>
    </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";?>
  • =?ISO-8859-1?Q?thib=B4?=

    #2
    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,f ilesize($conten t));
    ?>
    </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´

    Comment

    • Jerry Stuckle

      #3
      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,f ilesize($conten t));
      >?>
      ></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@attgl obal.net
      =============== ===

      Comment

      • =?ISO-8859-1?Q?thib=B4?=

        #4
        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,f ilesize($conten t));
        >>?>
        >></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´

        Comment

        Working...