示例#1
0
 /**
  * Gets the specifeid fields from the misc table
  * @param array $fields - fields to get, null gets the lot
  * @param string $errorString - error to generate on failure
  * @param string $id - optinoal user id
  * @return object
  */
 protected function getMisc($fields, $errorString, $id = "")
 {
     if ($id == "") {
         $where["UserId"] = $this->id;
     } else {
         $where["UserId"] = $id;
     }
     if (is_Array($fields)) {
         $row = $this->db->getf($this->cfg->userMiscTable, $fields, $where, $errorString);
     } else {
         $row = $this->db->get($this->cfg->userMiscTable, $where, $errorString);
     }
     return $row;
 }
示例#2
0
 /**
  * Log a user off the system, blanks all session data except language
  * @param SSP_Template $tpl - template object
  * @param bool $showLogoffScreen - display the logoff screen
  */
 public function logoff($tpl, $showLogoffScreen = true)
 {
     $userId = $this->userId;
     $returnPage = $this->getReturnPage();
     $fields = array("SessionIp" => '', "SessionRandom" => '0', "SessionData" => '0', "SessionUserIp" => '', "UserId" => '');
     $where = array("SessionId" => $this->sessionToken);
     $this->db->update($this->cfg->sessionTable, $fields, $where, "SSP Logoff: failed to clean up user data");
     // preserve language if needed
     if ($this->cfg->translate) {
         $lang = $this->lang;
         $_SESSION = array(self::LANGSESSIONVAR => $this->lang);
     } else {
         $_SESSION = array();
     }
     if ($this->cfg->loginRememberMe and isset($_COOKIE[$this->cfg->loginRememberMeCookie])) {
         $id = $_COOKIE[$this->cfg->loginRememberMeCookie];
         // delete remeber me cookie if it exists
         setcookie($this->cfg->loginRememberMeCookie, "", time() - 172800, "/", $this->cfg->cookieDomain, $this->cfg->useSSL);
         $values = array("id" => $id);
         $this->db->delete($this->cfg->tableRememberMe, $values, "SSP Logoff: removing remember me entry");
     }
     $this->loggedIn = false;
     $this->userId = '';
     $this->userEmail = '';
     $this->userName = '';
     $this->userAccessLevel = '';
     $this->admin = false;
     $this->userInfo = NULL;
     $this->miscInfo = NULL;
     if ($showLogoffScreen) {
         return $this->displayLogOffScreen($tpl, $userId, $returnPage);
     }
 }