function DoLogin() { $this->mUser->mUserName = $this->mUserName; $this->FetchUserInfo(); SysLog::Instance()->log('User (' . $this->mUserName . ') active: ' . $this->GetCurrentUser()->GetActive(), 'login'); if ($this->GetCurrentUser()->GetActive() != 'Yes') { return FALSE; } $hashed = $this->IsPasswordHashed(); $salt = $this->GetSalt(); if ($hashed) { $hash = md5(md5($salt . $this->GetCurrentUser()->GetPassword())); } else { $hash = $this->mUser->mPassword; } SysLog::Instance()->log('comparing: ' . $this->mPassword . ' == ' . $hash . ' hashed=' . $hashed . ' salt=' . $salt, 'login'); if (md5($this->mPassword) == $hash) { SysLog::Instance()->log('Logged in!', 'login'); $this->mIsLoggedIn = true; $_SESSION['is_logged_in'] = true; $_SESSION['username'] = (string) $this->mUserName; Session::Instance()->Restart(); // regenerate session_id, prevent session fixation } else { $this->mIsLoggedIn = false; $_SESSION['is_logged_in'] = false; $_SESSION['username'] = Configuration::Instance()->GetValue('application', 'default_user'); } return $this->mIsLoggedIn; }
function NusoapResponse() { // force to set global variable $debug // before calling parent constructor $GLOBALS['debug'] = $this->mDebugMode; parent::soap_server(); $this->configureWsdl(__CLASS__ . 'Service', FALSE, $this->mEndpoint); $this->mrDispatcher = Dispatcher::Instance(); $this->mrSecurity = Security::Instance(); $this->mrSession = Session::Instance(); if (!empty($this->mRegisteredFunctions)) { foreach ($this->mRegisteredFunctions as $func_name => $params) { if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } if (!empty($this->mRegisteredTypes)) { foreach ($this->mRegisteredTypes as $type_name => $params) { if (is_array($params) && count($params) > 0) { if ($params['type'] == 'complexType' && $params['phptype'] != 'scalar') { $this->wsdl->addComplexType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']); } else { $this->wsdl->addSimpleType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']); } } else { $this->register($func_name); } } } $this->wsdl->addComplexType('ListType', 'complexType', 'array'); $this->wsdl->addComplexType('AgmListType', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:integer[]')), 'xsd:integer'); }
public static function getInstance() { if (self::$Instance === null) { self::$Instance = new Session(); } return self::$Instance; }
function RunConfigurationHook($configName, $configKey) { if ($configName == 'application' && $configKey == 'basedir') { return Session::Instance()->GetSessionBaseDir(); } else { return NULL; } }
function RunConfigurationHook($configName, $configKey) { if ($configName == 'application' && $configKey == 'session_save_handler') { return Session::Instance()->GetSaveHandler(); } else { return NULL; } }
function IsSessionExpired($sessionId) { $result = $this->Open($this->mSqlQueries['read_data'], array($sessionId)); if (!$result) { return TRUE; } else { $last_modified = strtotime($result[0]['SessionCTime']); if (time() - $last_modified > Session::Instance()->Expire() * 60) { // expired? return TRUE; } else { return FALSE; } } }
private function __construct() { if ((!isset($_SESSION['start_key']) || !isset($_SESSION['mult_key']) || !isset($_SESSION['add_key'])) && Session::Instance()->IsStarted()) { $_SESSION['start_key'] = mt_rand(1024, mt_getrandmax()); $_SESSION['mult_key'] = mt_rand(1024, mt_getrandmax()); $_SESSION['add_key'] = mt_rand(1024, mt_getrandmax()); } elseif (!Session::Instance()->IsStarted()) { // default key $_SESSION['start_key'] = 981; $_SESSION['mult_key'] = 12674; $_SESSION['add_key'] = 35891; echo "test"; } $this->mStartKey = $_SESSION['start_key']; $this->mMultKey = $_SESSION['mult_key']; $this->mAddKey = $_SESSION['add_key']; }
function DoLogin() { $this->mUser->mUserName = $this->mUserName; $this->FetchUserInfo(); SysLog::Instance()->log('User (' . $this->mUserName . ') active: ' . $this->GetCurrentUser()->GetActive(), 'login'); if ($this->GetCurrentUser()->GetActive() != 'Yes') { return FALSE; } SysLog::Instance()->log('Comparing: (supplied) ' . md5($this->mPassword) . ' == (original) ' . $this->GetCurrentUser()->GetPassword(), 'login'); if ($this->GetCurrentUser()->GetPassword() == md5($this->mPassword)) { SysLog::Instance()->log('Logged in!', 'login'); $this->mIsLoggedIn = true; $_SESSION['is_logged_in'] = true; $_SESSION['username'] = $this->mUserName; Session::Instance()->Restart(); // regenerate session_id, prevent session fixation } else { $this->mIsLoggedIn = false; } return $this->mIsLoggedIn; }
public static function release() { if (!self::IsActive()) { return; } // ### return, no active session ### $Connector = Connector::getInstance(); $DropSessions = $Connector->prepare('DELETE FROM `' . RP_TABLE_PREFIX . 'Session` WHERE SessionId = :SessionId LIMIT 1'); $DropSessions->bindValue(':SessionId', self::$Instance->SessionId, PDO::PARAM_INT); $DropSessions->execute(); self::$Instance->SessionId = 0; self::$Instance->Data = null; self::$Instance->IsDirty = false; self::updateCookie(false, time() - 3600); self::$Instance = null; }
function Start() { if (!Configuration::Instance()->GetValue('application', 'session_sso_enabled')) { return FALSE; } if (!isset($_COOKIE[$this->mName])) { $this->CreateSsoId(); } else { $this->mId = $_COOKIE[$this->mName]; if ($this->mLocalCacheEnabled) { if (!file_exists($this->FileName())) { if ($sso_data = $this->RetrieveSsoInfoFromMaster()) { // apply user info here $_SESSION['username'] = $sso_data['username']; $_SESSION['is_logged_in'] = $sso_data['is_logged_in']; } else { $this->CreateSsoId(); } } else { $last_modified = filemtime($this->FileName()); if (time() - $last_modified > Session::Instance()->Expire() * 60) { // expired? // try to update from master first if ($sso_data = $this->RetrieveSsoInfoFromMaster()) { // apply user info here $_SESSION['username'] = $sso_data['username']; $_SESSION['is_logged_in'] = $sso_data['is_logged_in']; } else { $this->CreateSsoId(); } } else { if ($sso_data = $this->RetrieveSsoInfoFromLocal()) { // apply user info here $_SESSION['username'] = $sso_data['username']; $_SESSION['is_logged_in'] = $sso_data['is_logged_in']; } else { $this->CreateSsoId(); } } } } else { if ($sso_data = $this->RetrieveSsoInfoFromMaster()) { // apply user info here $_SESSION['username'] = $sso_data['username']; $_SESSION['is_logged_in'] = $sso_data['is_logged_in']; } else { $this->CreateSsoId(); } } } list($app_id, $sso_id, $seq) = explode('-', $this->mId); if ($this->mLocalCacheEnabled || Configuration::Instance()->GetValue('application', 'application_id') == $app_id) { register_shutdown_function(array($this, 'UpdateLocalSsoInfo')); } }
<?php /* * Get current users information */ $session = Session::Instance(); # Sample Data $array = array("user_name" => $session["User"]["vnd_first_name"] . $session["User"]["vnd_last_name"]); # Render if authorized, otherwise, not. if (!Security::Authorized()) { Page::Redirect("login", "You must be logged in!"); } $Smarty->assign("users", $array); $Smarty->display('SiteDashboard.tpl');
<?php require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/gtfw/session/save_handler/SessionSaveHandlerIntf.intf.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/gtfw/session/Session.class.php'; Session::Instance()->PrepareSaveHandler(); Session::Instance()->Start(); //getgetConfig From DB must get after session created ConfigurationHelper::InstanceClass()->GetAllValues();
function Logout($destroySession = FALSE) { if (!$this->mSecurityEnabled) { return TRUE; } if ($this->mAuthentication->DoLogout($destroySession)) { SysLog::Instance()->log('Security: logged out', 'login'); $result = true; } else { $result = false; } // ensure these two session vars is set $_SESSION['is_logged_in'] = $this->IsLoggedIn(); $_SESSION['username'] = $this->mAuthentication->GetCurrentUser()->GetUserName(); if ((bool) Configuration::Instance()->GetValue('application', 'session_multiuser_enabled')) { Session::Instance()->RegenerateSessionDirId(); } SessionSso::Instance()->TakeOverSsoMaster(); return $result; }
function GtfwSess() { return Session::Instance(); }