Re: include() and sessions
| From: | Chris Shiflett | Date: | Tue, 11 Feb 2003 21:59:34 +0000 |
| Subject: | Re: include() and sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135251@lists.php.net to get a copy of this message | ||
Hello Lindsey,
I am posting this to php-general@lists.php.net for you. The php-dev list is for
the development of PHP itself, not for user questions.
Also, as a guess to your problem, when you include a resource by URL, you are
going to receive the same output that a browser would (when you view source),
so any PHP code in that resource is going to be executed prior to receipt. If
this is a local file, you should use the filesystem path instead. For example:
include '/home/lindsey/public_html/foo.php';
instead of:
include 'http://www.example.org/~lindsey/foo.php';
If you must use a URL and you want to retain session, you will have to pass
your session identifier on the URL.
Chris
--- Lindsey Simon <lsimon@commoner.com> wrote:
> I have a situation involving my session and an include().
>
> I'm trying to include() a page using the full path. My session is
> registered and I can verify all is well with it. I want to retain the
> session from within the page I'm including.
>
> So:
>
> I'm pasting my code here (please ignore the variables except the session
> stuff at the end.
>
> $this_URL = $URL . "index.php?modu=display_shots&show_ident=" .
> $_REQUEST['select_ident'] . "&select_ident=" .
> $_REQUEST['select_ident']
> .. "&noheader=1&nofooter=1&no_print_link=1&add_record=1&" .
> session_name() . "=" . session_id();
> include($this_URL);
>
> my webserver just hangs and I have to restart it in order to get any
> more pages from anywhere on the server.
>
> I've tested this in 4.2.3 and 4.3.
>
> Is my syntax correct in terms of what I should append to the
> URL when include()ing it? I'm basing it on what I read about passing SID
> (which I can't use since it's returning empty on the page where I have
> the include() line)
>
> Thanks for your help,
> -l