function nor_auth_is_member($groupname) { nor_auth_require_login(); $conn = nor_db_connect(); $res = nor_db_q("select id from groups where groupname = " . nor_sql_quote($groupname), $conn); $row = nor_db_fetch_row($res); if (!$row) { nor_fail("Internal error: Missing group in database."); } $account_id = $_SESSION['auth_account_id']; $group_id = $row[0]; $res = nor_db_q("select * from account_group_memberships" . " where account_id={$account_id} and group_id={$group_id}", $conn); return nor_db_fetch_row($res) !== false; }
function authMysql($login, $pwd) { if (!$this->insideMysqlDomain()) { return; } $conn = nor_db_connect(); $res = nor_db_q('select id,password,new_password,username,full_name from accounts ' . 'where username='******'OR username='******'{$login}'"); } if ($row and $pwd and $pwd == $row[1] || $pwd == $row[2]) { $this->dbg("authMysql: login OK"); return array($row[4], $row[3], $row[0]); } }