This is a discussion on "Help with SESSION vars, please?" within the PHP Forum section. This forum, and the thread "Help with SESSION vars, please? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Help with SESSION vars, please?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Help with SESSION vars, please?
I'm having a lot of trouble with session variables. They seem to be very unreliable and unset themselves at unexpected times. I figured out that you have to do a session_commit() before redirecting (and pass the sid to the new url), but now I'm finding that session vars will sometimes unset just by posting a form - even when it's posting to the same page.
Are there some good, hard rules that you seasoned vets live by in order to use SVs reliably? If so, can you please post them? Many thanks! |
|
|
|
|||
|
Re: Help with SESSION vars, please?
Odd - I've never had any problems. They're rock solid for me.
A thought - are you using multiple connections to the same session at the same time - for example are you using frames, or session based PHP scripts to generate muliple content in the same page at the same time, such as a whole series of related images? |
|
|||
|
Re: Help with SESSION vars, please?
Nope. Nothing funky like that. The closest thing to funky that I've got going on is that I'm testing on IE5.5 using a local (xampp) web server. (I seem to have similar problems even if I test on FF, tho, so maybe it's a xampp issue.)
Thanks for the help, Graham. |
|
|||
|
Re: Help with SESSION vars, please?
It occurred to me that maybe my expectations of session vars are too high...
I expect my session vars to be there because I expect the sid to remain the same... but as I'm posting forms and doing redirects, the sid does change. Maybe that's my problem? Maybe they're rock solid for you because you expect the sid to change? So, to insure proper use of session vars I need to pass the sid in a cookie (that expires at the end of the session) OR in the url? I can see where the url would be the more reliable, in case cookies are disabled, but the advantage of the cookie would be that the sid would be retained even after the user leaves the "framework" of the current page (i.e. where the code is specifically written to pass the sid in the URL). If the user goes to another page/area of the site, then returns to this page via the nav bar (the link for which, naturally, does not contain a parameter to pass the sid), then the cookie would keep me from having to do all of the "no session var" processing again. Is that a more realistic expectation? Or do session vars work for you without "jumping through those hoops"? |
![]() |
| Tags |
| session, session variables, session vars |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A very simple question ref Array vars and HTML <TD>!! | crazie | JavaScript Forum | 2 | Mar 15th, 2008 13:09 |
| appending vars | moiseszaragoza | Flash & Multimedia Forum | 1 | Apr 5th, 2007 03:42 |
| Session vars and Security new to ASP | djanim8 | Classic ASP | 2 | Dec 10th, 2005 12:59 |
| session php | iamzoli | PHP Forum | 2 | Apr 7th, 2004 05:49 |
| Session Variables | ekendricks | Classic ASP | 7 | Aug 26th, 2003 10:42 |