session_id() will return the id that PHP is currently using to keep track of its session.
session_id() will return the id that PHP is currently using to keep track of its session.
Just to make sure I understand, when the applet submits the session id (which it does as an http request) I can do the following to active the session?
If any of the above is wrong, please let me know. Thanks.PHP Code:$sessionId = $_POST["sessionId"]; // php script receives the session id
session_start(); // starts session
session_id = $sessionId; // set the session id, so that previously set session variables can be used
No, of course not. session_id() is a function, not a variable; all variables in PHP start with $.
There's a magic request variable that PHP will automatically pick up and use as the session ID. By default, it's called PHPSESSID. You can set the current session ID by callingsession_id($newid);, e.g.session_id($_POST['sessionId']);, but it's easier just to use the default variable.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
That was a mental lapse; I was looking at java and javascript code right before my post. You're absolutely right, as session_id is a function I'd have to send the posted session id ($_POST[sessionId]) as an argument.
Thanks for the clarification; I was concerned that by setting the session id I might "overwrite" the previously set session rather than invoking it.
Bookmarks