PHP problem!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Validus
    Confirmed User
    • Jul 2001
    • 4012

    #1

    PHP problem!

    I wonder why this doesn't work. Anybody have any ideas?

    <?
    $fp = fopen("source.php", "r");
    $out = fread($fp, filesize("output.php"));
    ?>

    <? echo $out; ?>
  • Validus
    Confirmed User
    • Jul 2001
    • 4012

    #2
    But But But... php is cool!

    Comment

    • SetTheWorldonFire
      Confirmed User
      • Feb 2002
      • 7444

      #3
      send me $1000 immediatly!
      www.STWOFDesign.com
      hit me up on icq 154206276 or Skype: JaimeGizzle

      Comment

      • dodo
        Confirmed User
        • Jan 2002
        • 162

        #4
        Originally posted by Validus
        I wonder why this doesn't work. Anybody have any ideas?

        <?
        $fp = fopen("source.php", "r");
        $out = fread($fp, filesize("output.php"));
        ?>

        <? echo $out; ?>
        you are opening source.php and using filesize of output.php.

        you should use the filesize of source.php. remember to close $fp

        FREE TRAFFIC TRADING on any host. Also try our 200% traffic back program.Click here
        We host the scripts for you so you trade on our bandwidth.

        Comment

        • Socks
          Confirmed User
          • May 2002
          • 8475

          #5
          Did that fix your problem?

          Comment

          • NitroPhil
            Confirmed User
            • Jun 2002
            • 103

            #6
            Originally posted by dodo


            you are opening source.php and using filesize of output.php.

            you should use the filesize of source.php. remember to close $fp

            Yeah, that's exactly what's going on. Having a starting PHP tag would help to. As long as you do filesize() on source.php instead of output.php, it should be cool.
            <a href="http://www.lightspeedcash.com"> Make money at the speed of light!</a><br>
            - Wouldn't it be cool to own a retarded monkey?

            Comment

            • leverage7
              Registered User
              • Jun 2002
              • 9

              #7
              Originally posted by Validus
              I wonder why this doesn't work. Anybody have any ideas?

              <?
              $fp = fopen("source.php", "r");
              $out = fread($fp, filesize("output.php"));
              ?>

              <? echo $out; ?>
              In addition to the filesize() being called on a different file, make sure that source.php is in your php include path.

              You can get your include_path by calling

              ini_get('include_path');

              and you can change it by calling

              ini_set('include_path', '/path/one:/path/two:/etc');

              Comment

              • foe
                Confirmed User
                • May 2002
                • 5246

                #8
                Originally posted by dodo


                you are opening source.php and using filesize of output.php.

                you should use the filesize of source.php. remember to close $fp

                exactly, not much to add, closing $fp is recomended but not necessary as it will be closed at end of script.

                Also when posting in the future copy and paste php errors if there are any as well

                Comment

                Working...