Re: [PHP] Read Vs. Include

2001-01-31 Thread Daniel Grace


On Tuesday, January 30, 2001 at 3:04 PM, Alexandar Skwar wrote:
> So sprach Daniel Grace am Thu, Jan 25, 2001 at 07:18:52PM -0800:
> > readfile($filename);
>
> Why not include?
>

Because include will execute any PHP code in the included file and readfile
will not, it just dumps the entire file to the webbrowser.

If you want to display the contents of an HTML document and that HTML
document should not have any PHP code in it, it's best to play it safe and
use readfile(). This is especially true if the HTML document can be visitor
modified (say, a guestbook), as not doing so could potentially let anybody
execute any PHP code they want on your webserver.

 - Daniel Grace 

  "Space may be the final frontier but its made in a Hollywood basement."
- Red Hot Chili Peppers - Californication



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Read Vs. Include

2001-01-30 Thread Alexander Skwar

So sprach Daniel Grace am Thu, Jan 25, 2001 at 07:18:52PM -0800:
> readfile($filename);

Why not include?

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die guenstige Art an Linux Distributionen zu kommen
Uptime: 2 hours 56 minutes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Read Vs. Include

2001-01-26 Thread Daniel Grace

Any of these will work:

echo implode("\n", file($filename));

fpassthru(fopen($filename, "r"));

readfile($filename);

You probably want readfile().
http://www.php.net/manual/en/function.readfile.php

--
 - Daniel Grace 

  "Space may be the final frontier but its made in a Hollywood basement."
- Red Hot Chili Peppers - Californication
""Karl J. Stubsjoen"" <[EMAIL PROTECTED]> wrote in message
005b01c086fa$ec53ba30$0afc020a@kstubsjoen">news:005b01c086fa$ec53ba30$0afc020a@kstubsjoen...
> Hello,
>
> I want to *read* a file into a page and not process any PHP.  I'm just
> reading an HTML file.  I though it was simple, I thought I had it figured
> out, but now when I try, I get the following error:
>
> Fatal error: Call to unsupported or undefined function read() in
> /var/www/wherever.com/betastore/iscookies.php on line 41
>
> Here is the code (line 41 is superceded by a +):
>
> 37: # display no cookies message
> 38: function NoCookies() {
> 39: global $DOCUMENT_ROOT;
> 40: $LocalScript = $DOCUMENT_ROOT . "/betastore";
> 41:  read ($LocalScript . "/thispage.html");
> 42: }
>
> Thanks for any help.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Read Vs. Include

2001-01-26 Thread Richard Lynch

> I want to *read* a file into a page and not process any PHP.  I'm just
> reading an HTML file.  I though it was simple, I thought I had it figured
> out, but now when I try, I get the following error:

Unless there is PHP code in there that you want to make sure it doesn't get
executed, 'include' will work just fine.

If you need to read the file and splat it to the browser, I think passthru()
is what you want.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Read Vs. Include

2001-01-25 Thread Karl J. Stubsjoen

Hello,

I want to *read* a file into a page and not process any PHP.  I'm just
reading an HTML file.  I though it was simple, I thought I had it figured
out, but now when I try, I get the following error:

Fatal error: Call to unsupported or undefined function read() in
/var/www/wherever.com/betastore/iscookies.php on line 41

Here is the code (line 41 is superceded by a +):

37: # display no cookies message
38: function NoCookies() {
39: global $DOCUMENT_ROOT;
40: $LocalScript = $DOCUMENT_ROOT . "/betastore";
41:  read ($LocalScript . "/thispage.html");
42: }

Thanks for any help.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]