function isValid() { $valid = true; // expired if (HTTP_Session::isExpired()) { $valid = false; HTTP_Session::destroy(); throw new WebServiceException(WebServiceErrorCode::$SESSLIFEOVER, "Session has life span over please login again"); } // idled if (HTTP_Session::isIdle()) { $valid = false; HTTP_Session::destroy(); throw new WebServiceException(WebServiceErrorCode::$SESSIONIDLE, "Session has been invalidated to due lack activity"); } //echo "<br>is new: ", HTTP_Session::isNew(); //invalid sessionId provided. //echo "<br>get: ",$this->get($this->sessionVar); if (!$this->get($this->sessionVar) && !HTTP_Session::isNew()) { $valid = false; HTTP_Session::destroy(); throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID, "Session Identifier provided is Invalid"); } return $valid; }
/** * Initialize session */ static function init($sessionid = false) { if (empty($sessionid)) { HTTP_Session::start(null, null); $sessionid = HTTP_Session::id(); } else { HTTP_Session::start(null, $sessionid); } if (HTTP_Session::isIdle() || HTTP_Session::isExpired()) { return false; } return $sessionid; }