コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: Session.php プロジェクト: cannking/vtigercrm-debug
 /**
  * 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;
 }