- if ($res [0] == 1) {
- if ($create_if_not_exists) {
- $query = sprintf ("UPDATE %susers SET pwd='%s' WHERE name like '%s';",
- $this->dbprefix, md5 ($pwd), $usrname_escaped);
- } else {
- throw new Exception (anydbConnection::err_query);
- }
+ return ($res [0] == 1);
+ }
+
+ public function setpwd ($user_name, $pwd) {
+ $usrname_escaped = mysql_real_escape_string ($user_name);
+ if ($this->user_exists ($user_name)) {
+ $query = sprintf ("UPDATE %susers SET pwd='%s' WHERE name like '%s';",
+ $this->dbprefix, md5 ($pwd), $usrname_escaped);