/** * 修改密码执行页面 * @author 陈晓东 */ public function repwdUpdateAction() { /** * 记录日志 */ $log = "修改密码执行页面\n\nServerIp:\n" . $this->request->getServer('SERVER_ADDR') . "\n\nGET:\n" . var_export($_GET, true) . "\n\nPOST:\n" . var_export($_POST, true); $this->oLogManager->push('log', $log); $id = trim($this->request->id); //用户ID $oldpasswd = trim($this->request->oldpasswd); //原密码 $newpasswd = trim($this->request->newpasswd); //新密码 $confirm = trim($this->request->confirm); //确认密码 $Widget_Manager = new Widget_Manager(); $password = $Widget_Manager->getOne($id, 'password'); if ($password != md5($oldpasswd)) { $response = array('errno' => 1); echo json_encode($response); return false; } if ($newpasswd != $confirm) { $response = array('errno' => 2); echo json_encode($response); return false; } if (strlen($newpasswd) < 6 || strlen($newpasswd) > 18) { $response = array('errno' => 3); echo json_encode($response); return false; } $admin = $this->manager->get(); if ($id != $admin['id']) { $response = array('errno' => 4); echo json_encode($response); return false; } $bind['password'] = md5($newpasswd); $res = $this->manager->update($id, $bind); if ($res) { $response = array('errno' => 0); } else { $response = array('errno' => 9); } echo json_encode($response); return true; }