how to regenerate your own session id
| From: | treeml | Date: | Tue, 12 Aug 2003 14:12:31 +0000 |
| Subject: | how to regenerate your own session id | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159288@lists.php.net to get a copy of this message | ||
There is a function called, session_regenerate_id, for php4.3.2 and above.
Right now, it just creates a random id. Is there a way to specify the value
of the regenerated session_id? So I can record the SID before I send out
every time.
I tried,
session_id('id_generated_me');
session_start();
This code does write a new SID, but it also resets the session. Which means
I can't get the data set in the previous session.
I also tried,
session_start();
setcookie(session_name(), SID_generated_by_me );
believe it or not, this just puts another cookie in the client browser with
same "session_name". (I didn't even know that 2 cookies from the same
domain, with same session name is possible, I thought one would just replace
the other) And the session is still reading from the old cookie with the old
SID.
I search through the doc, but have no luck. Any suggestion appreciated.
Thanks.
Tree