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('/usr/share/alternc/panel/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'];
$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'];
}
// separamos email en 2, usuario y dominio
$u_email = explode("@", $username);
$u_lp = $u_email[0];
$u_domain = $u_email[1];
// encrypt new password
$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 address SET password=\"$crypted_passwd\"
WHERE address = \"$u_lp\"
AND domain_id = (SELECT id FROM domaines
WHERE domaine = \"$u_domain\")";
//print "
".$query;
$result=mysql_query($query, $connect_sql);
// print resultados...
//while($row = mysql_fetch_assoc($result)){
// foreach($row as $cname => $cvalue){
// print "$cname: $cvalue\t";
// }
// print "\r\n";
//}
if ($result)
{return true;}else return false;
}else
{return false;}
}else
{return false;}
}
}
?>