public static function changeAccount($iAccountId) { //TODO:check if the user has access to change to that account //change account id in session to $iAccountId $_SESSION['account_id'] = $iAccountId; $_SESSION['account_domain'] = YASE_Account::getDomain($_SESSION['account_id']); }
static function login($sLogin, $sPassword) { $res = mysql_query("SELECT login from user where login='******' and password='******'"); $row = mysql_fetch_row($res); $sLoggedIn = $row[0]; if (isset($sLoggedIn)) { $_SESSION['login'] = $sLoggedIn; $_SESSION['user_id'] = YASE_User::getId($_REQUEST['username']); $_SESSION['account_id'] = YASE_User::getFirstAccountId(); $_SESSION['account_domain'] = YASE_Account::getDomain($_SESSION['account_id']); return true; } else { return false; } }
<?php require_once 'classes/YASE/Framework.php'; $id = YASE_User::getId("pedant.dk"); $_SESSION['user_id'] = $id; $aid = YASE_User::getFirstAccountId($id); print_r(YASE_Account::getDomain($aid) . "\r\n");