1 | <? |
---|
2 | |
---|
3 | class uiEgw-passwd-sync { |
---|
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('/var/alternc/bureau/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 | $table=$GLOBALS['mail_change_pwd']['table_users']; |
---|
27 | $username =$GLOBALS['egw_info']['user']['account_lid']; |
---|
28 | |
---|
29 | //para cuando se cambia una cuenta desde admin |
---|
30 | if ($_GET['menuaction'] =='admin.uiaccounts.edit_user') |
---|
31 | { |
---|
32 | $username =$_REQUEST['account_lid']; |
---|
33 | } |
---|
34 | |
---|
35 | $username_=str_replace("@","_",$username); |
---|
36 | $crypted_passwd=_md5cr($data['new_passwd']); |
---|
37 | |
---|
38 | $connect_sql=mysql_connect($db_host.":".$db_port,$db_pwd_user,$db_pwd_pass); |
---|
39 | if ($connect_sql) |
---|
40 | { |
---|
41 | $db=mysql_select_db($db_pwd_name,$connect_sql); |
---|
42 | if($db) |
---|
43 | { |
---|
44 | $query="UPDATE $table SET password=\"$crypted_passwd\" |
---|
45 | WHERE alias in (\"$username\",\"$username_\")"; |
---|
46 | |
---|
47 | // print "<br /><br /><br />".$query; |
---|
48 | |
---|
49 | $result=mysql_query($query, $connect_sql); |
---|
50 | |
---|
51 | if ($result) |
---|
52 | {return true;}else return false; |
---|
53 | }else |
---|
54 | {return false;} |
---|
55 | |
---|
56 | }else |
---|
57 | {return false;} |
---|
58 | } |
---|
59 | } |
---|
60 | ?> |
---|