Here are the changes if you are using Roundcube with hMailServer...
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/settings/change_password.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
| Show edit form for a identity record or to add a new one |
| |
+-----------------------------------------------------------------------+
| Author: Nicolas Van Eenaeme <nicolas@poison.be> |
+-----------------------------------------------------------------------+
$Id: edit_identity.inc,v 1.1 2006/05/21 05:19:43 roundcube Exp $
*/
// The host of the database
define ('RCUBE_EXT_CHANGE_PASS_HOST', 'localhost');
// The username to connect to the database
define ('RCUBE_EXT_CHANGE_PASS_USER', 'user');
// The password to connect to the database
define ('RCUBE_EXT_CHANGE_PASS_PASS', 'password');
// The name of the database
define ('RCUBE_EXT_CHANGE_PASS_NAME', 'database');
// The update query. You can use '%clear%' for the clear password,
// '%md5%' for the md5 encrypted password,
// '%user%' for the username,
// '%old%' for the old password and
// '%oldmd5%' for the old md5 encrypted password.
define ('RCUBE_EXT_CHANGE_PASS_UPDATEQUERY', 'UPDATE hm_accounts SET accountpassword = "%md5%" WHERE accountaddress = "%user%" AND accountpassword = "%oldmd5%"');
// The select query (needed to verify the md5.
define ('RCUBE_EXT_CHANGE_PASS_SELECTQUERY', 'SELECT accountpassword FROM hm_accounts WHERE accountaddress = "%user%"');
function change_password_function ($user, $currentpass, $newpass)
{
$dbh =& mysql_connect (RCUBE_EXT_CHANGE_PASS_HOST, RCUBE_EXT_CHANGE_PASS_USER, RCUBE_EXT_CHANGE_PASS_PASS);
if (!is_resource ($dbh))
return FALSE;
if (!mysql_select_db (RCUBE_EXT_CHANGE_PASS_NAME, $dbh))
return FALSE;
$q = str_replace ('%user%', $user, RCUBE_EXT_CHANGE_PASS_SELECTQUERY);
$dbr =& mysql_query ($q, $dbh);
if (!is_resource ($dbr))
return FALSE;
$data = mysql_fetch_row ($dbr);
mysql_free_result ($dbr);
$newpassmd5 = md5($newpass);
$currentpassmd5 = md5($currentpass);
$q = str_replace (array ('%user%', '%clear%', '%md5%', '%old%', '%oldmd5%'), array ($user, $newpass, $newpassmd5, $currentpass, $currentpassmd5), RCUBE_EXT_CHANGE_PASS_UPDATEQUERY);
$dbr =& mysql_query ($q, $dbh);
if (!$dbr || mysql_affected_rows ($dbh) != 1)
return FALSE;
mysql_close ($dbh);
return TRUE;
}
?>