Mailinglisten-Archive |
Hallo Ihr,
ich versuche mich gerade daran die Auth-Klasse zu
erweitern um den Punkt des Editierens von Usern.
Leider ergeben sich da kleine Probleme. ;)
Auth.php habe ich folgend erweitert:
// {{{ editUser()
/**
* Add user to the storage container
*
* _(at)_access public
* _(at)_param string Username
* _(at)_param string Password
* _(at)_param string Userid
* _(at)_param mixed Additional parameters
*/
function editUser($username, $password, $userid,
$additional = "")
{
return $this->storage->editUser($username,
$password, $userid, $additional);
}
// }}}
Container/DB.php:
// {{{ editUser()
/**
* Edit user in the storage container
*
* _(at)_access public
* _(at)_param string Username
* _(at)_param string Password
* _(at)_param integer Userid
*
* _(at)_return mixed True on success,
otherwise error object
*/
function editUser($username, $password, $userid)
{
echo "username: ".$username." - passwort: "
.$password." - userid: ".$userid."<br>";
$query = sprintf("UPDATE %s SET %s='%s',
%s='%s' WHERE %s=%s)",
$this->options['table'],
$this->options['usernamecol'],
$username,
$this->options['passwordcol'],
md5($password),
$this->options['useridcol'],
$userid
);
echo "query: ".$query."<br>";
$res = $this->db->query($query);
echo "res: ".$res."<br>";
if (DB::isError($res)) {
return new DB_Error($res->code, PEAR_ERROR_DIE);
} else {
return true;
}
}
// }}}
Ansprechen tu ich das ganze über:
$a = new Auth("DB", $params);
$a -> editUser($username, $password, $userid);
Dies ergibt folgende Fehlermeldung:
username: abcd - passwort: abc - userid: 3
query: UPDATE auth SET username='abcd',
password='900150983cd24fb0d6963f7d28e17f72'
WHERE userid=3)
Fatal error: Call to a member function on a non-object
in PEAR/Auth/Container/DB.php on line 289
Hat jemand einen Tip für mich?
Gruß
Björn
php::bar PHP Wiki - Listenarchive