Example #1
0
 function change_pwd($id, $pwd, $old)
 {
     $user_id = $GLOBALS['user']['id'];
     if ($id != $user_id) {
         if ($GLOBALS['user']['power'] != 1) {
             return '权限不够';
         }
     }
     $new_pwd = new password($id, $old);
     if (!$new_pwd->check_pwd()) {
         return "密码错误";
     }
     if (!$new_pwd->up_pwd($pwd)) {
         return "修改密码错误";
     }
     if (!$this->clear_mysql_cookie($id)) {
         return "更新数据失败";
     }
     return 'OK';
 }