db = \Zend_Registry::get('db'); }else{ $this->db = $db; } $this->config = \Zend_Registry::get('config'); } public function checkParam(\Zend_EventManager_Event $e){ $data = $e->getParam('data'); $type = $e->getParam('type'); if($type == 'general') { if(empty($data['realname'])) { return "请输入真实姓名"; } if(mb_strlen($data['realname'],"UTF-8")>10 ) { return "姓名不要超过10个字"; } } if($type == "password") { if(strlen($data['password'])>18 || strlen($data['password_new'])>18) { return "密码过长"; } if(strlen($data['password_new'])<=6 || strlen($data['password_confirm'])<=6) { return "密码过短"; } if(md5($data['password_new']) != md5($data['password_confirm'])) { return "两次输入的密码不同"; } $uid = view::User('id'); $sql = "SELECT {$this->FieldPasword} FROM {$this->tbl_member} WHERE id=$uid"; $rs = $this->db->query($sql); $row = $rs->fetch(); if(md5($data['password']) != $row[$this->FieldPasword]) { return "原密码不正确"; } } return true; }//checkParam public function editSuccess(\Zend_EventManager_Event $e){ $data = $e->getParam('data'); return true; } }