From b09cba5084accb1ec71abf0b1b45268dc4147198 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 13 Nov 2006 22:59:58 +0000 Subject: [PATCH] Set Assoc mode always after DB connection. Discovered by MDL-7443 Merged from MOODLE_17_STABLE --- auth/db/lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/auth/db/lib.php b/auth/db/lib.php index f8e78f0a6a..e0db9bc677 100644 --- a/auth/db/lib.php +++ b/auth/db/lib.php @@ -22,7 +22,8 @@ function auth_user_login ($username, $password) { // Connect to the external database $authdb = &ADONewConnection($CFG->auth_dbtype); - $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); + $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); + $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection if ($CFG->auth_dbpasstype === 'internal') { // lookup username externally, but resolve @@ -92,6 +93,7 @@ function auth_get_userinfo($username){ ADOLoadCode($CFG->auth_dbtype); $authdb = &ADONewConnection(); $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); + $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection $fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", @@ -299,6 +301,7 @@ function auth_user_exists ($username) { global $CFG; $authdb = &ADONewConnection($CFG->auth_dbtype); $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); + $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection $rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable WHERE $CFG->auth_dbfielduser = '$username' "); @@ -331,6 +334,7 @@ function auth_get_userlist() { // Connect to the external database $authdb = &ADONewConnection($CFG->auth_dbtype); $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); + $authdb->SetFetchMode(ADODB_FETCH_ASSOC); ///Set Assoc mode always after DB connection // fetch userlist $rs = $authdb->Execute("SELECT $CFG->auth_dbfielduser AS username @@ -456,4 +460,4 @@ function auth_validate_form(&$form, &$err) { return true; } -?> \ No newline at end of file +?> -- 2.39.5