diff --git a/src/components/session/session.php b/src/components/session/session.php index 1fa4001..7bd5d0d 100644 --- a/src/components/session/session.php +++ b/src/components/session/session.php @@ -59,11 +59,20 @@ public function getSid() { * Read Session information for the given index * * @param string $name The name of the index to read + * @param boolean $persist If set data will persist, otherwise will be cleared after read * @return mixed The value stored in $name of the session, or an empty string. */ - public function read($name) { - if (isset($_SESSION[$name])) - return $_SESSION[$name]; + public function read($name, $persist=true) { + if (isset($_SESSION[$name])){ + $val = $_SESSION[$name]; + + if($persist == false){ + $this->clear($name); + } + + return $val; + } + return ""; } @@ -276,4 +285,4 @@ private function sessionGarbageCollect($lifetime) { return $this->Record->affectedRows(); } } -?> \ No newline at end of file +?>