source: trunk/egroupware/CTA/inc/class.uiCTA.inc.php @ 778

Last change on this file since 778 was 778, checked in by autocommit@…, 8 years ago

un print menos, no era necesario

File size: 1.9 KB
RevLine 
[774]1<?
2
3class uiCTA {
4
5        var $public_functions = array(
6                "changepassword" => True
7                );
8
9        function changepassword ($data)
10        {
[778]11        //print ($GLOBALS['egw_info']['user']['account_lid']);
[777]12        //print "<br>";
13        //print_r($data);
14        //print "<br>GET :";
15        //print_r ($_GET);
16        //print "<br>POST:";
17        //print_r ($_POST);
[776]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'];
[774]25
[776]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
[777]35                // separamos email en 2, usuario y dominio
36                $u_email = explode("@", $username);
37                $u_lp = $u_email[0];
38                $u_domain = $u_email[1];
39
40                // encrypt new password
[776]41                $crypted_passwd=_md5cr($data['new_passwd']);
42
43                $connect_sql=mysql_connect($db_host.":".$db_port,$db_pwd_user,$db_pwd_pass);
[777]44                if ($connect_sql)
45                {
46                        $db=mysql_select_db($db_pwd_name,$connect_sql);
47                        if($db)
48                        {
49                                $query="UPDATE address SET password=\"$crypted_passwd\"
50                                         WHERE address = \"$u_lp\"
51                                              AND domain_id = (SELECT id FROM domaines 
52                                                  WHERE domaine = \"$u_domain\")";
53
54                                //print "<br /><br /><br />".$query;
55
56                                $result=mysql_query($query, $connect_sql);
57
58                                // print resultados...
59                                //while($row = mysql_fetch_assoc($result)){
60                                //    foreach($row as $cname => $cvalue){
61                                //        print "$cname: $cvalue\t";
62                                //    }
63                                //    print "\r\n";
64                                //}
65 
66                                if ($result)
67                                        {return true;}else return false;
68                                }else
69                                        {return false;}
70
71                }else
72                {return false;}
[774]73        }
74}
[775]75?>
Note: See TracBrowser for help on using the repository browser.