On Sun, Jan 25, 2004 at 06:26:26PM -0800, Jonathan Hilgeman wrote:
> 
> I'm running into some weird trouble here. I'm a very experienced PHP
> programmer, but I rarely ever deal with framed sites. A client wants a
> framed PHP site that needs session data passed between the frames.

Mu.

A session is merely an array tied to a cookie.  "Session variables" are
elements of that array, and the cookie is maintained by the entire
browser, regardless of window or frame.  Since PHP is server-side,
there's no way for data to be "passed between the frames".  You'd need
client-side programming for that.  The extent of your PHP-based controls
over frame content consists of named targets, the same as HTML.

But anyway...

> The top frame is a nav bar that changes from time to time by means of
> Javascript updating it (I know this all should've been done without frames
> and Javascript, but the client is REQUIRING frames and JS is the fastest way
> to update the frames).

I've dealt with more than one company that required an HTTP proxy set up
on their corporate firewall set up to strip Javascript from web content
in-transit, due to paranoid security policies.  Whether those policies
make sense is moot; the fact that they exist anywhere means that your
client's requirements are born of ignorance ... but you obviously know
that already.  ;-)

> The bottom frame is the main content area.
> 
> All three objects here (parent, top frame, bottom frame) have a common
> header that does things like connect to the database, session_start() and
> register session variables.

Register?  As in, session_register()?  May I humbly recommend that you
switch to $_SESSION[] instead, for the more sensible notation and
compatibility with future default php installs?

> When I try to log in, the information is passed to the parent, which
> authenticates the user, and then changes the top frame to a header page that
> is more customized for the user. The bottom frame changes to the user's
> control panel.
> 
> Here's where the problem comes in. As I move around in the bottom frame,
> going from page to page, the session seems to randomly die, and then it
> starts doing things like appending $PHP_SESSID to the links and stuff.

Are you calling a session_name() with a custom session name before you
call session_start()?  If some scripts define a session_name() that
isn't included for other scripts, you may be losing your session as its
name is inadvertently changed.

If you're calling session_name(), are you sure the value is just
alphanumeric?  Non-alnum characters may or may not work.  (Usually not.)

> If I try to login again, it seems to authenticate correctly in the parent,
> but when the parent tries to change the top frame and bottom frame, those
> frames don't always seem to recognize the login attempt. It's almost like
> each frame suddenly split into its own session, identified by its own
> $PHP_SESSID. Sometimes it works, sometimes it doesn't.

If multiple frames are trying to update session variables at the same
time, you may be experiencing file locking issues in your session files.
Check http://php.net/session_write_close for some discussion on this.

> I don't understand what's happening here. Any thoughts?

If none of the above suggestions help, then I have no clue.  :-)

p

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/

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

Reply via email to