Help with SESSION vars, please?

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 9th, 2007, 19:27
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 233
Thanks: 4
Thanked 0 Times in 0 Posts
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!
Reply With Quote

  #2 (permalink)  
Old May 10th, 2007, 06:05
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote
  #3 (permalink)  
Old May 10th, 2007, 20:13
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 233
Thanks: 4
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #4 (permalink)  
Old May 28th, 2007, 15:53
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 233
Thanks: 4
Thanked 0 Times in 0 Posts
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"?
Reply With Quote
Reply

Tags
session, session variables, session vars

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 20:52.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43