class UserClass {
public $sessionID;
public $username;
public function __sleep() {
session_destroy();
return array("username");
}
public function __wakeup() {
session_start();
$this->sessionId = session_id();
}
}
session_start();
$user = new UserClass;
$user->sessionId = session_id();
$seralized_user = serialize($user);
unset($user);
$user = unserialize($serialized_user);
?>