/** * 修改密码 */ public function modifypwdAction() { $type = $this->_request->getParam("type"); $this->view->Type = $type; if ($type == 'post') { $oldpwd = md5(strip_tags(trim($this->_request->getParam("oldpwd")))); $newpwd = strip_tags(trim($this->_request->getParam("newpwd"))); $repeatnewpwd = strip_tags(trim($this->_request->getParam("repeatnewpwd"))); $UserMapper = new Application_Model_UserMapper(); $arr = $UserMapper->checkUser($_SESSION['user']['UserName'], $oldpwd); if (!empty($arr)) { if ($newpwd != "" && $newpwd == $repeatnewpwd) { $res = $UserMapper->modifyUserPwd($arr[0]['UID'], $newpwd); if (!isset($res)) { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"修改失败 %>_<%\");history.back();</script>"; echo $string; exit; } else { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"修改成功!\\n请用新密码重新登录\");location.href = \"/login/logout/type/noalert\";</script>"; echo $string; exit; } } else { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"新密码有问题\\n请修改后重新提交\");history.back();</script>"; echo $string; exit; } } else { $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"原密码错误\");history.back();</script>"; echo $string; exit; } } else { if ($type == 'facebox') { $this->_helper->layout->disableLayout(); } } }