library/core/class.cookieidentity.php
public function SetIdentity($UserID, $Persist = FALSE) {
      if (is_null($UserID)) {
         $this->_ClearIdentity();
         return;
      }
      
      $this->UserID = $UserID;
      
      // If we're persisting, both the cookie and its payload expire in 30days
      $PayloadExpires = time();
      if ($Persist) {
         
         $PayloadExpires += (86400 * self::COOKIE_PERSIST_DAYS);
         $CookieExpires = $PayloadExpires;
         
      // Otherwise the payload expires in 2 days and the cookie expires on borwser restart
      } else {
         // Note: $CookieExpires = 0 causes cookie to die when browser closes.
         
         $PayloadExpires += (86400 * self::COOKIE_SESSION_DAYS);
         $CookieExpires = 0;
      }

      // Create the cookie
      $KeyData = $UserID.'-'.$PayloadExpires;
      $this->_SetCookie($this->CookieName, $KeyData, array($UserID, $PayloadExpires), $CookieExpires);
      $this->SetVolatileMarker($UserID);
   }
public function SetIdentity($UserID, $Persist = FALSE) {
      if (is_null($UserID)) {
         $this->_ClearIdentity();
         return;
      }
      
      $this->UserID = $UserID;
      
      // If we're persisting, both the cookie and its payload expire in 30days
      $PayloadExpires = time();
      if ($Persist) {
         
         $PayloadExpires += (86400 * self::COOKIE_PERSIST_DAYS);
         $CookieExpires = $PayloadExpires;
         
      // Otherwise the payload expires in 2 days and the cookie expires on borwser restart
      } else {
         // Note: $CookieExpires = 0 causes cookie to die when browser closes.
         
         $PayloadExpires += (86400 * self::COOKIE_SESSION_DAYS);
         $CookieExpires = 0;
      }

      // Create the cookie
      $KeyData = $UserID.'-'.$PayloadExpires;
      $this->_SetCookie($this->CookieName, $KeyData, array($UserID, $PayloadExpires), $CookieExpires);
      $this->SetVolatileMarker($UserID);
   }
public function SetIdentity ( $ UserID , $ Persist = FALSE ) { if ( is_null ( $ UserID ) ) { $ this -> _ClearIdentity ( ) ; return ; } $ this -> UserID = $ UserID ; // If we're persisting, both the cookie and its payload expire in 30days $ PayloadExpires = time ( ) ; if ( $ Persist ) { $ PayloadExpires += ( 86400 * self :: COOKIE_PERSIST_DAYS ) ; $ CookieExpires = $ PayloadExpires ; // Otherwise the payload expires in 2 days and the cookie expires on borwser restart } else { // Note: $CookieExpires = 0 causes cookie to die when browser closes. $ PayloadExpires += ( 86400 * self :: COOKIE_SESSION_DAYS ) ; $ CookieExpires = 0 ; } // Create the cookie $ KeyData = $ UserID . '-' . $ PayloadExpires ; $ this -> _SetCookie ( $ this -> CookieName , $ KeyData , array ( $ UserID , $ PayloadExpires ) , $ CookieExpires ) ; $ this -> SetVolatileMarker ( $ UserID ) ; }
Generates the user's session cookie.

@param int $UserID The unique id assigned to the user in the database.
@param boolean $Persist Should the user's session remain persistent across visits?
Generates the user s session cookie .