示例#1
0
 private function getSession($userkey = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "getSession");
     //----------------------------------------------------------
     if (is_null($userkey)) {
         $userkey = $_COOKIE['user'];
     }
     //----------------------------------------------------------
     if (isset($userkey)) {
         $userKeyArr = explode("-", $userkey);
         //----------------------------------------------------------
         if (session_id() == '') {
             session_start();
         }
         //------------------------------------------------------
         $session_id = GenFun::encrypt(session_id() . $this->salt . $userKeyArr[0]);
         //-------------------------------------------------------
         $queryString = "SELECT * \n\t\t\tFROM accounts,sessionLog\n\t\t\t\n\t\t\tWHERE sessionLog.accounts_id = accounts.id \n\t\t\t\n\t\t\tAnd sessionLog.userKey='" . $userkey . "' \n\t\t\t\n\t\t\tAND sessionLog.session_id='" . $session_id . "' \n\t\t\t\n\t\t\tAND sessionLog.disabled='0' \n\t\t\t\n\t\t\tAND accounts.email='" . $userKeyArr[0] . "'";
         //---------------------------------------------------
         $chk = Result::go($queryString, array("greaterZero" => true));
         //---------------------------------------------------
     } else {
         $chk['bool'] = false;
     }
     //-------------------------------------------------------
     if (!$chk['bool'] && !$chk['error']) {
         $chk['message'] = 'user not logged in';
     }
     //-------------------------------------------------------
     Constants::$getSession = $chk;
     //-------------------------------------------------------
     if ($chk['bool']) {
         Constants::$loggedIN = $chk['result'][0];
     }
     //-------------------------------------------------------
     return $chk;
 }
示例#2
0
 private function getSession($userkey = NULL)
 {
     Trace::output($this->traceID, "getSession", func_get_args());
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "getSession");
     //----------------------------------------------------------
     if (is_null($userkey)) {
         $userkey = $_COOKIE[$this->cookiePrefix . 'user'];
     }
     //----------------------------------------------------------
     if (isset($userkey)) {
         $userKeyArr = explode("-", $userkey);
         //----------------------------------------------------------
         if (session_id() == '') {
             session_start();
         }
         //------------------------------------------------------
         //$session_id = GenFun::encrypt(session_id().$this->salt.$userKeyArr[0]);
         //-------------------------------------------------------
         $queryString = "SELECT ";
         $queryString .= "accounts.*, ";
         $queryString .= "CONCAT('" . ProjectGlobal::$filesPath . "', files.name) as img_url ";
         $queryString .= "FROM ";
         $queryString .= "accounts, ";
         $queryString .= "files, ";
         $queryString .= "sessionLog ";
         $queryString .= "WHERE ";
         $queryString .= "sessionLog.accounts_id = accounts.id ";
         $queryString .= "AND files.id = accounts.profile_files_id ";
         $queryString .= "AND sessionLog.userKey='" . urldecode($userkey) . "' ";
         $queryString .= "AND sessionLog.disabled IS NULL ";
         $queryString .= "AND accounts.email='" . urldecode($userKeyArr[0]) . "'";
         //---------------------------------------------------
         $chk = Result::go($queryString, array("greaterZero" => true));
         //---------------------------------------------------
     } else {
         $chk['bool'] = false;
     }
     //-------------------------------------------------------
     if (!$chk['bool'] && !$chk['error']) {
         $chk['message'] = 'user not logged in';
     }
     //-------------------------------------------------------
     Constants::$getSession = $chk;
     //-------------------------------------------------------
     if ($chk['bool']) {
         Constants::$loggedIN = $chk['result'][0];
     }
     //-------------------------------------------------------
     return $chk;
 }