[web] session data being dropped(almost figured it out)[php]

Started by
10 comments, last by Mage2k 17 years, 3 months ago
Quote:Original post by exorcist_bob
1) (using session ID in query string) I'm not. How can I set session.use_only_cookies?


Use ini_set to set it before you call session_start.

Quote:
2)Right now, I'm using http://localhost/.


Provided you use an entirely unique and single host name for your web site, any should work. Don't host the same site on multiple domains.

Quote:
- If set, ensure that the cookie domain and path are correct (hint: It's generally easier not to specify them)
3)What do you mean?


I mean that when you set the cookies (or when the session handler sets them), you should ensure that the domain and path on those cookies is right. By default they're probably not set, which is good for most sites.

Quote:
4)Does it matter that the page is inside an iframe? Every page is unique.


To some extent, yes.

Frames load in a nondeterministic way - sessions variables set in an outer frame may not be visible in the inner one because they haven't been set yet.

Don't rely on setting a session var in an outer frame, and reading it in an inner frame, as the web browser may request the iframe before the parent page request is finished.

PHP only saves session variables when the page finishes loading (From the server's perspective; it may still be loading on the client).

Quote:
How can I check/set that?


Check / set what? Your response didn't quote my message in a structured way.

Mark
Advertisement
Quote:Original post by exorcist_bob
How can I create a global variable that won't be reinitialized every time I include a file that declares it with new?
Use require_once() instead of include()

---------------------------------------------------There are 10 kinds of people in the world:Those that understand binary, and those that dont...Mage

This topic is closed to new replies.

Advertisement