RE: Including remote PHP script, Return DO NOT works.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't claim a script can't return a value. All I say is
that the key word "return" is meant to be used with functions,
not with scripts. In other words using "return" in a script,
like the previous suggestion, is a semantic mistake/fault,
and wont work as intended - in my naive oppinion, the
interpreter should return an error message if a return
is encountered outside a function.

It's all about sematics of usage.

-----Original Message-----
From: DvDmanDT
To: php-windows@xxxxxxxxxxxxx
Sent: 2004-04-10 15:41
Subject: Re:  Including remote PHP script, Return DO NOT works.

Accutually, you _can_ return from included files, see manual for more
info on that..

Why it doesn't work, is because the script will include the generated
HTML from simples.php, which is probably nothing.. Meaning there will be no
return statement,, And when there's no return in the file, include()
will return the status of the include (true or false, 1 or 0).. To make that
work, try to rename simples.php to simples.txt and include it.. Cause then
it wont be parsed by the server before PHP gets it.. Hope it makes sense..

For both of you, look at this page:
http://php/manual/en/function.include.php#AEN5536
-- 
// DvDmanDT
MSN: dvdmandt$hotmail.com
Mail: dvdmandt$telia.com
"B.A.T. Svensson" <B.A.T.Svensson@xxxxxxx> skrev i meddelandet
news:D291F33C586C8E48B95C26F8C805513A01A3DA16@xxxxxxxxxxxxxxxx
> You should have a closer look at the concept of a function.
>
> A function are suposed to return a value (with "return"),
> not a script.
>
> Try this in your main script:
>
> $fu = bar();
> echo "$fu<br>\n";
>
> --[in your include file you need to have something likje this:]----
>
> function bar()
>   $val = "simples";
>   return $val;
> }
>
> ------------------------------------------------
>
>
>
>
> -----Original Message-----
> From: ricardo.junior@xxxxxxxxxxxxxxxxxx
> To: php-windows@xxxxxxxxxxxxx
> Sent: 2004-04-10 03:55
> Subject:  Including remote PHP script, Return DO NOT works.
>
> Hi All,
>
> I don't know if this is the wanted situation...
> If you include a full URL path to a file in your own server (or
specify
> a remote php script) that has a RETURN statment, the value is not
return
> from this script (remotely or locally with full URL path).
>
> See example below:
>
> simples.php 's code:
> <?
>   $val = "simples";
>   return $val;
> ?>
> -----------------------------------------------
> main_1.php 's code:
> <?
>    $resultado = include ("./simples.php");
>    print_r($resultado);
> ?>
> -----------------------------------------------
> main_2.php 's code:
> <?
>    $resultado = include ("http://localhost/simples.php";);
>    print_r($resultado);
> ?>
> -----------------------------------------------
>
> Running main_1.php (http://localhost/main_1.php) I got the following
> output:
>
>    simples
>
> Running main_2.php (http://localhost/main_2.php) I got the following
> output instead of "simples" as before:
>
>    1
>
> This is a normal situation?
> If yes (or also if this is a bug), what could be done to return the
> result of a remote script execution? There is another way to get the
result
> of a external execution?
>
> I need this to external users be able to run SQL commands on my mysql
> server without pass them my server password. I pretend to use a
> username/password protection to do some users just access some
tables...
> There is something like that I can use?
>
> Tahnks a lot,
> Ricardo Jr.
>
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux