note 55634 deleted from ref.session by bjori
| From: | bjori@php.net | Date: | Mon, 11 Sep 2006 15:07:09 +0000 |
| Subject: | note 55634 deleted from ref.session by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117019@lists.php.net to get a copy of this message | ||
Note Submitter: jphansen at uga dot edu
----
I found the easiest method of saving and restoring a user's session data was storing $_SESSION
to a database:
<?
addslashes(var_export($_SESSION, TRUE))
?>
Then restoring it using eval():
<?
eval("\$_SESSION = $session;");
// $session = the first line of code above
?>
Without eval(), $_SESSION = $session would have resulted in $_SESSION being a string instead of an
array.