[thelist] Saving and Destroying Session IDs and Vars with PHP5

Pringle, Ron RPringle at aurora-il.org
Tue Mar 6 14:07:55 CST 2007


Tim wrote:

Why do you need to keep the same session ID?

Anyway, you can probably just store the current session ID in a variable::

// Get the current ID
$sessionId = session_id();	

// Kill the session
session_destroy();	

// Start a new session with the old ID
session_id( $sessionId );	
session_start();

-- 

I am probably going about it the wrong way. I create a session_id on login. All the session vars that I write from the form POST values are then written under that ID. I probably need to create a new named session just for the form itself to keep it separate from the login session? Then I could just destroy that session after the form has been submitted, correct?

I'm learning as I'm going, so I'm not opposed to going back and changing things. I've got some time to play with this to get it right.

Thanks for the response!

Regards,
Ron



More information about the thelist mailing list