public function sessionPageStart($pageID, $currentIP) { $this->storgeCheck(); $this->authSetting->pageID = $pageID; if ($this->sessionID != null) { //$GLOBALS['registry']->db->setDebug(DEBUG_FULL_MODE); $this->authSetting->userObject = $GLOBALS['registry']->db->getRecord('users', 'u.*', USERS_TABLE . ' u,' . SESSIONS_TABLE . ' s', 'AND u.User_Status = ' . ACTIVE_STATUS . ' AND s.User_ID = u.User_ID AND s.Session_ID = \'' . $this->sessionID . '\''); if (!is_object($this->authSetting->userObject)) { $this->errorHandle(ERR_NO_EXISTS_USER_LOGIN_KEY); } else { $sessionIPCheck = substr($this->sessionUser->sessionIP, 0, 6); $currentIPCheck = substr($currentIP, 0, 6); if ($sessionIPCheck == $currentIPCheck) { //check if the ip login == ip in the session //$SID = ($sessionmethod == SESSION_METHOD_GET || defined('IN_ADMIN')) ? $session_id : ''; if ($this->authSetting->currentTime - $userObject->User_Session_Time > 60) { $sessionsModel = new sessionsModel(); $sessionsModel->Session_Time = $this->authSetting->currentTime; $sessionsModel->Session_Page = $this->authSetting->pageID; $sessionsModel->setCondition(array('Session_ID' => $this->sessionID)); //$update_admin = (!defined('IN_ADMIN') && $current_time - $user['session_time'] > ($config['session_length']+60)) ? ', session_admin = 0' : ''; if (!$GLOBALS['registry']->db->editStmtPrep($sessionsModel, true) > 0) { $this->errorHandle(ERR_UPDATE_SESSION_LOGIN_KEY); } if ($this->authSetting->userID != ANONYMOUS) { $usersModel = new usersModel(); $usersModel->User_Session_Time = $this->authSetting->currentTime; $usersModel->User_Session_Page = $this->authSetting->pageID; $usersModel->setCondition(array('user_ID' => $this->authSetting->userID)); if (!$GLOBALS['registry']->db->editStmtPrep($usersModel, true) > 0) { $this->errorHandle(ERR_UPDATE_USER_LOGIN_KEY); } } $this->cleanSession(); $this->saveSession(); } if (isset($this->sessionData['autologinID']) && $this->sessionData['autologinID'] != '') { $this->sessionUser->sessionKey = $this->sessionData['autologinID']; } return $this->sessionUser; } } $this->authSetting->userID = isset($this->sessionData['userID']) ? intval($this->sessionData['userID']) : ANONYMOUS; if (!($this->sessionUser = $this->sessionUserBegin())) { $this->errorHandle(ERR_CREATE_USER_SESSION_KEY); } } return $this->sessionUser; }