class uiCTA {
var $public_functions = array(
"changepassword" => True
);
function changepassword ($data)
{
// print ($GLOBALS['egw_info']['user']['account_lid']);
// print "
";
// print_r($data);
// print "
GET :";
// print_r ($_GET);
// print "
POST:";
// print_r ($_POST);
include_once('/var/alternc/bureau/class/functions.php');
$db_host=$GLOBALS['mail_change_pwd']['db_host'];
$db_port=$GLOBALS['mail_change_pwd']['db_port'];
$db_pwd_user=$GLOBALS['mail_change_pwd']['db_user'];
$db_pwd_name=$GLOBALS['mail_change_pwd']['db_name'];
$db_pwd_pass=$GLOBALS['mail_change_pwd']['db_pass'];
$table=$GLOBALS['mail_change_pwd']['table_users'];
$username =$GLOBALS['egw_info']['user']['account_lid'];
//para cuando se cambia una cuenta desde admin
if ($_GET['menuaction'] =='admin.uiaccounts.edit_user')
{
$username =$_REQUEST['account_lid'];
}
$username_=str_replace("@","_",$username);
$crypted_passwd=_md5cr($data['new_passwd']);
$connect_sql=mysql_connect($db_host.":".$db_port,$db_pwd_user,$db_pwd_pass);
if ($connect_sql)
{
$db=mysql_select_db($db_pwd_name,$connect_sql);
if($db)
{
$query="UPDATE $table SET password=\"$crypted_passwd\"
WHERE alias in (\"$username\",\"$username_\")";
// print "
".$query;
$result=mysql_query($query, $connect_sql);
if ($result)
{return true;}else return false;
}else
{return false;}
}else
{return false;}
}
}
?>