Re: [PHP] Syntax Error - This is WEIRD!

2004-01-20 Thread Nick Wilson

* and then Dagfinn Reiersøl declared
 Yes your right, that?s exactly the problem. I didn?t even realize he was
 doing that.
 
 By including the PHP file via HTTP, you are including the OUTPUT of the PHP
 file, not the actual PHP file itself.
 
 e.g.
 
 by including a file with the following code:
 
 ?PHP
 
  print 'Hello';
 
 ?
 
 you would be including the word Hello as PHP code, which is obviously
 going to cause a syntax error.
  
 
 Yes. I read the manual which provides no clear explanation (I suspect 
 that whoever wrote it didn't actually know how it works). So I decided 
 to test it. It does exactly what you say it does. I made an include file 
 like this:
 
 ?php
 echo '?php echo Hello World!; ?';
 ?
 
 If you inlude that using HTTP, it outputs Hello world!
 
 Seems like a strange thing to do, outputting PHP code on a Web page, but 
 it's not without conceivable usefulness.

That does appear to be the trouble doesnt it? - thanks guys, i'm now
talking to the support people for this CMS and trying to work out how to
do it differently/correctly!

Thanks for all the help!


-- 
Nick W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Nick Wilson
if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:

?php
// line one above this one


What's the deal there?

Many thanks for any insight ;-)
-- 
Nick W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Richard Davey
Hello Nick,

Friday, January 16, 2004, 2:16:43 PM, you wrote:

NW if a script calls antohter like
NW 'include('http://site.com/index.php');

NW Why would I get a syntax error on line 1 of index.php when it looks like
NW this:

NW ?php
NW // line one above this one

NW What's the deal there?

Say you've got 2 scripts. a.php and b.php

If in a.php you have the line:

include('http://www.whatever.com/b.php');

Then you have two possible causes for the error.

1) a.php errors somewhere (i.e. in your code you had a ' infront
of the include function for some reason).

2) b.php has an error in it which is being echo'd out by a.php

Remember, a.php will not actually include the b.php code and then
run it, it will just request and display the output from b.php - so if
that script causes an error, that is what you'll see appear on your
page.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Nick Wilson

* and then Richard Davey declared
 Hello Nick,
 
 Friday, January 16, 2004, 2:16:43 PM, you wrote:
 
 NW if a script calls antohter like
 NW 'include('http://site.com/index.php');
 
 NW Why would I get a syntax error on line 1 of index.php when it looks like
 NW this:
 
 NW ?php
 NW // line one above this one
 
 NW What's the deal there?
 
 Say you've got 2 scripts. a.php and b.php
 
 If in a.php you have the line:
 
 include('http://www.whatever.com/b.php');
 
 Then you have two possible causes for the error.
 
 1) a.php errors somewhere (i.e. in your code you had a ' infront
 of the include function for some reason).
 
 2) b.php has an error in it which is being echo'd out by a.php

Problem is, its a well know and well tested script. Is there anything im
my settings that could cause this?

THanks!

-- 
Nick W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Donald Tyler
There could be something you're not seeing and assuming it's correct. But
typing your code into the email we aren't getting the full story.

Can you actually attach your scripts to an email and send that? Copying and
pasting then into the email won't necessarily provide all the info needed to
solve your problem.

For example: I once uploaded a PHP script to the server and for some reason
on the way up extra character were placed in the document that did not show
up in most text editors. I had to use a very basic terminal text editor to
see the added characters.

-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 8:17 AM
To: php-general
Subject: [PHP] Syntax Error - This is WEIRD!

if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:

?php
// line one above this one


What's the deal there?

Many thanks for any insight ;-)
-- 
Nick W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Jeremy
Did the script accidently get saved in MS-DOS text format?

-Original Message-
From: Donald Tyler [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 8:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Syntax Error - This is WEIRD!


There could be something you're not seeing and assuming it's correct.
But
typing your code into the email we aren't getting the full story.

Can you actually attach your scripts to an email and send that? Copying
and
pasting then into the email won't necessarily provide all the info
needed to
solve your problem.

For example: I once uploaded a PHP script to the server and for some
reason
on the way up extra character were placed in the document that did not
show
up in most text editors. I had to use a very basic terminal text editor
to
see the added characters.

-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 8:17 AM
To: php-general
Subject: [PHP] Syntax Error - This is WEIRD!

if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:

?php
// line one above this one


What's the deal there?

Many thanks for any insight ;-)
-- 
Nick W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Dagfinn Reiersøl
Nick Wilson wrote:

if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:
?php
// line one above this one
What's the deal there?

Many thanks for any insight ;-)
 

I've never tried to do an include via HTTP, so maybe I'm clueless, but
it occurs to me that it might be a good idea to try doing a plain old
file include, using exactly the same file. I have the feeling it would
be interesting to know whether that would work or not.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Donald Tyler
Yes your right, that’s exactly the problem. I didn’t even realize he was
doing that.

By including the PHP file via HTTP, you are including the OUTPUT of the PHP
file, not the actual PHP file itself.

e.g.

by including a file with the following code:

?PHP

print 'Hello';

?

you would be including the word Hello as PHP code, which is obviously
going to cause a syntax error.

-Original Message-
From: Dagfinn Reiersøl [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 10:18 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!

Nick Wilson wrote:

if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:

?php
// line one above this one


What's the deal there?

Many thanks for any insight ;-)
  

I've never tried to do an include via HTTP, so maybe I'm clueless, but
it occurs to me that it might be a good idea to try doing a plain old
file include, using exactly the same file. I have the feeling it would
be interesting to know whether that would work or not.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Dagfinn Reiersl
Donald Tyler wrote:

Yes your right, thats exactly the problem. I didnt even realize he was
doing that.
By including the PHP file via HTTP, you are including the OUTPUT of the PHP
file, not the actual PHP file itself.
e.g.

by including a file with the following code:

?PHP

	print 'Hello';

?

you would be including the word Hello as PHP code, which is obviously
going to cause a syntax error.
 

Yes. I read the manual which provides no clear explanation (I suspect 
that whoever wrote it didn't actually know how it works). So I decided 
to test it. It does exactly what you say it does. I made an include file 
like this:

?php
echo '?php echo Hello World!; ?';
?
If you inlude that using HTTP, it outputs Hello world!

Seems like a strange thing to do, outputting PHP code on a Web page, but 
it's not without conceivable usefulness.

-Original Message-
From: Dagfinn Reiersl [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 10:18 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!

Nick Wilson wrote:

 

if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:
?php
// line one above this one
What's the deal there?

Many thanks for any insight ;-)

   

I've never tried to do an include via HTTP, so maybe I'm clueless, but
it occurs to me that it might be a good idea to try doing a plain old
file include, using exactly the same file. I have the feeling it would
be interesting to know whether that would work or not.
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Jason Wong
On Saturday 17 January 2004 01:50, Dagfinn Reiersl wrote:

 Yes. I read the manual which provides no clear explanation (I suspect
 that whoever wrote it didn't actually know how it works). So I decided
 to test it. It does exactly what you say it does. I made an include file
 like this:

In defence of the manual writers, the manual says:

... the script is actually being run on the remote server and the *result* is 
then being included into the local script.

What is not clear about that?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The difficult we do today; the impossible takes a little longer.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Donald Tyler
Yes that is true. But I would strongly recommend against doing that.

You should never include anything over HTTP. Its extremely messy, 100%
insecure and just a very very bad idea.

You should have all the files you need to include located on your web
server.

-Original Message-
From: Dagfinn Reiersøl [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 11:50 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!

Donald Tyler wrote:

Yes your right, that’s exactly the problem. I didn’t even realize he was
doing that.

By including the PHP file via HTTP, you are including the OUTPUT of the PHP
file, not the actual PHP file itself.

e.g.

by including a file with the following code:

?PHP

   print 'Hello';

?

you would be including the word Hello as PHP code, which is obviously
going to cause a syntax error.
  

Yes. I read the manual which provides no clear explanation (I suspect 
that whoever wrote it didn't actually know how it works). So I decided 
to test it. It does exactly what you say it does. I made an include file 
like this:

?php
echo '?php echo Hello World!; ?';
?

If you inlude that using HTTP, it outputs Hello world!

Seems like a strange thing to do, outputting PHP code on a Web page, but 
it's not without conceivable usefulness.

-Original Message-
From: Dagfinn Reiersøl [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 10:18 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!

Nick Wilson wrote:

  

if a script calls antohter like 'include('http://site.com/index.php');

Why would I get a syntax error on line 1 of index.php when it looks like
this:

?php
// line one above this one


What's the deal there?

Many thanks for any insight ;-)
 



I've never tried to do an include via HTTP, so maybe I'm clueless, but
it occurs to me that it might be a good idea to try doing a plain old
file include, using exactly the same file. I have the feeling it would
be interesting to know whether that would work or not.

  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Dagfinn Reiers?l
Jason Wong wrote:

On Saturday 17 January 2004 01:50, Dagfinn Reiersl wrote:

  

Yes. I read the manual which provides no clear explanation (I suspect
that whoever wrote it didn't actually know how it works). So I decided
to test it. It does exactly what you say it does. I made an include file
like this:



In defence of the manual writers, the manual says:

... the script is actually being run on the remote server and the *result* is 
then being included into the local script.

What is not clear about that?

  

E...

Well...

Reading that one sentence and knowing for sure what the correct answer
is, it's crystal clear. When I read the whole explanation the first
time and was slightly confused already, it was like a wandering through
a foggy night. This sentence, for instance:

If the target server interprets the target file as PHP code, variables
may be passed to the included file
using an URL request string as used with HTTP GET. 

I read as used with as meaning that this is not quite the same thing
as an HTTP GET, whereas
in fact it is an HTTP GET. And thinking about it now, I realize that it
could hardly be anything else.

Which also means that the phrase about interpreting the file as PHP code
is slightly misleading, since
presumably the same comment would apply to a JSP or any other dynamic
Web page, as long as its *output* is PHP
code.

I think that's enough linguistics for now.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax Error - This is WEIRD!

2004-01-16 Thread Dagfinn Reiersøl
Donald Tyler wrote:

Yes that is true. But I would strongly recommend against doing that.

You should never include anything over HTTP. Its extremely messy, 100%
insecure and just a very very bad idea.
 

My spontaneous reaction is to agree with you. On the other hand, are 
SOAP or XML-RPC over
HTTP any more secure in principle? You would need some kind of 
authentication, of course,
unless you just love exposing your code.

It's a weird concept, but I was trying to give the guy who started the 
thread the benefit of the doubt. Maybe
he has a good reason for doing it. Maybe the people who implemented this 
feature in PHP had a good reason for
implementing it.

You should have all the files you need to include located on your web
server.
 

Yes, I don't know why you would want to keep them on a remote server.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php