1 | <? |
---|
2 | |
---|
3 | class uiCTA { |
---|
4 | |
---|
5 | var $public_functions = array( |
---|
6 | "changepassword" => True |
---|
7 | ); |
---|
8 | |
---|
9 | function changepassword ($data) |
---|
10 | { |
---|
11 | //print ($GLOBALS['egw_info']['user']['account_lid']); |
---|
12 | //print "<br>"; |
---|
13 | //print_r($data); |
---|
14 | //print "<br>GET :"; |
---|
15 | //print_r ($_GET); |
---|
16 | //print "<br>POST:"; |
---|
17 | //print_r ($_POST); |
---|
18 | |
---|
19 | include_once('/usr/share/alternc/panel/class/functions.php'); |
---|
20 | $db_host=$GLOBALS['mail_change_pwd']['db_host']; |
---|
21 | $db_port=$GLOBALS['mail_change_pwd']['db_port']; |
---|
22 | $db_pwd_user=$GLOBALS['mail_change_pwd']['db_user']; |
---|
23 | $db_pwd_name=$GLOBALS['mail_change_pwd']['db_name']; |
---|
24 | $db_pwd_pass=$GLOBALS['mail_change_pwd']['db_pass']; |
---|
25 | |
---|
26 | $username =$GLOBALS['egw_info']['user']['account_lid']; |
---|
27 | |
---|
28 | //para cuando se cambia una cuenta desde admin |
---|
29 | if ($_GET['menuaction'] =='admin.uiaccounts.edit_user') |
---|
30 | { |
---|
31 | $username =$_REQUEST['account_lid']; |
---|
32 | } |
---|
33 | |
---|
34 | // separamos email en 2, usuario y dominio |
---|
35 | $u_email = explode("@", $username); |
---|
36 | $u_lp = $u_email[0]; |
---|
37 | $u_domain = $u_email[1]; |
---|
38 | |
---|
39 | // encrypt new password |
---|
40 | $crypted_passwd=_md5cr($data['new_passwd']); |
---|
41 | |
---|
42 | $connect_sql=mysql_connect($db_host.":".$db_port,$db_pwd_user,$db_pwd_pass); |
---|
43 | if ($connect_sql) |
---|
44 | { |
---|
45 | $db=mysql_select_db($db_pwd_name,$connect_sql); |
---|
46 | if($db) |
---|
47 | { |
---|
48 | $query="UPDATE address SET password=\"$crypted_passwd\" |
---|
49 | WHERE address = \"$u_lp\" |
---|
50 | AND domain_id = (SELECT id FROM domaines |
---|
51 | WHERE domaine = \"$u_domain\")"; |
---|
52 | |
---|
53 | //print "<br /><br /><br />".$query; |
---|
54 | |
---|
55 | $result=mysql_query($query, $connect_sql); |
---|
56 | |
---|
57 | // print resultados... |
---|
58 | //while($row = mysql_fetch_assoc($result)){ |
---|
59 | // foreach($row as $cname => $cvalue){ |
---|
60 | // print "$cname: $cvalue\t"; |
---|
61 | // } |
---|
62 | // print "\r\n"; |
---|
63 | //} |
---|
64 | |
---|
65 | if ($result) |
---|
66 | {return true;}else return false; |
---|
67 | }else |
---|
68 | {return false;} |
---|
69 | |
---|
70 | }else |
---|
71 | {return false;} |
---|
72 | } |
---|
73 | } |
---|
74 | ?> |
---|