复制粘贴没难度, 过不去就是敲错了...
PrintWriter writer = resp.getWriter(); String verifycode = req.getParameter("verifycode"); String username = req.getParameter("username"); String password = req.getParameter("password"); HttpSession session =req.getSession(); String realCode = (String) session.getAttribute("sessionYzm"); if(!verifycode.equals(realCode)){ writer.write("验证码错误"); }else{ // writer.write("验证码正确"); if(username.equals("admin") && password.equals("admin123")){ writer.write("登录成功"); }else{ writer.write("登录失败"); } }
PrintWriter writer = resp.getWriter(); HttpSession session = req.getSession(); String trueCaptcha = (String)session.getAttribute(Constants.KAPTCHA_SESSION_KEY); String inputCaptcha = req.getParameter("captcha"); if(trueCaptcha.toLowerCase().equals(inputCaptcha.toLowerCase())) { writer.write("验证码输入正确"); } else { writer.write("验证码输入错误"); }
还有个文件同 01, 复制粘贴没难度
本来想发评论区的, 发现还要实名... 算了