Does anyone have a working examples of session management ?
I have attempted to use the 'start session' and $_SESSION as referenced in the documentation have encountered issues and the documentation seems week.
Questions;
- How do you test if a session is already active?
- In a given dynamic html page, do you need to open with 'start session' and close the page with a 'stop session' ?
- How do you set developer defined key/value pairs?
- Is there a list of $_SESSION keys exposed to the developer?
- Are any other $_ arrays exposed like; $_ENV or $_COOKIE
Thanks,
E
Session Management
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Session Management
I have just started playing with sessions myself. I'll try to answer some of your questions, but others more knowledgeable than me might have better answers...:
http://livecode.com/developers/api/6.0.2/
I hope this helps!
I have some session questions of my own, which I have not been able to find answers for anywhere in the documentation, such as: is there any XSS protection built-in? - i.e., is the session owner's authenticity verified solely by a cookie id, or does the session handler also check things like IP address and browser agent?
Unless you have explicitly started a session (with "start session"), then there is no active session.MrWizard. wrote:- How do you test if a session is already active?
The "stop session" command is used to save the session data to disk. You will usually call it after adding some data to the session array - not necessarily when the user is closing or leaving a page.- In a given dynamic html page, do you need to open with 'start session' and close the page with a 'stop session' ?
- How do you set developer defined key/value pairs?
Code: Select all
put "value" into $_SESSION["key"]
All the keys in $_SESSION.- Is there a list of $_SESSION keys exposed to the developer?
Yes, there are several - like $_COOKIE, $_POST, $GET, $_SERVER and more. Go to the API page, and do a search for "$_":- Are any other $_ arrays exposed like; $_ENV or $_COOKIE
http://livecode.com/developers/api/6.0.2/
I hope this helps!
I have some session questions of my own, which I have not been able to find answers for anywhere in the documentation, such as: is there any XSS protection built-in? - i.e., is the session owner's authenticity verified solely by a cookie id, or does the session handler also check things like IP address and browser agent?
Re: Session Management
You can find a very simple session example here: http://forums.livecode.com/viewtopic.ph ... ion#p50034