}
$authdb->Close();
return $result;
+
}
function user_exists($username) {
+ /// Init result value
+ $result = false;
+
$textlib = textlib_get_instance();
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->extencoding);
$rs = $authdb->Execute("SELECT * FROM {$this->config->table}
WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."' ");
- $authdb->Close();
if (!$rs) {
print_error('auth_dbcantconnect','auth');
- return false;
- }
-
- if ( $rs->RecordCount() ) {
+ } else if ( $rs->RecordCount() ) {
// user exists exterally
- return $rs->RecordCount();
- } else {
- // user does not exist externally
- return false;
+ $result = $rs->RecordCount();
}
+
+ $authdb->Close();
+ return $result;
}
function get_userlist() {
+ /// Init result value
+ $result = array();
+
$authdb = $this->db_init();
// fetch userlist
$rs = $authdb->Execute("SELECT {$this->config->fielduser} AS username
FROM {$this->config->table} ");
- $authdb->Close();
if (!$rs) {
print_error('auth_dbcantconnect','auth');
- return false;
- }
-
- if ( $rs->RecordCount() ) {
- $userlist = array();
+ } else if ( $rs->RecordCount() ) {
while ($rec = rs_fetch_next_record($rs)) {
- array_push($userlist, $rec->username);
+ array_push($result, $rec->username);
}
- return $userlist;
- } else {
- return array();
}
+
+ $authdb->Close();
+ return $result;
}
/**