From 09e47185124cc4674fac4656959d57c92537d355 Mon Sep 17 00:00:00 2001 From: "godzilla80@gmx.net" <> Date: Sat, 26 Feb 2011 13:53:39 +0000 Subject: Add THttpSession::regenerate() to update the current session id with a newly generated one --- framework/Web/THttpSession.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'framework/Web') diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php index bec4c126..adb91752 100644 --- a/framework/Web/THttpSession.php +++ b/framework/Web/THttpSession.php @@ -159,6 +159,21 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar $this->_started=false; } } + + /** + * Update the current session id with a newly generated one + * + * @param boolean $deleteOld Whether to delete the old associated session or not. + * @return string old session id + * @link http://php.net/manual/en/function.session-regenerate-id.php + */ + public function regenerate($deleteOld=false) + { + $old = $this->getID(); + session_regenerate_id($deleteOld); + $this->setID(session_id()); + return $old; + } /** * @return boolean whether the session has started -- cgit v1.2.3