Re: include() and sessions
| From: | Lindsey Simon | Date: | Tue, 11 Feb 2003 22:31:03 +0000 |
| Subject: | Re: include() and sessions | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-94175@lists.php.net to get a copy of this message | ||
Hey Chris, sorry - I only included it on this list because of the server
timeout thing. When I pass the session id and name my server hangs on
the include. I thought it might be pertinent.
> 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';
This is correct, I want the code to be executed. Specifically, I want to
pass GET variables along with the include that are not the same as the
current state of the GET variables on the page I'm calling include from.
> If you must use a URL and you want to retain session, you will have to pass
> your session identifier on the URL.
(see above)
> 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