savepasswd.jsp
来自「该源码为JSP的开发案例集锦」· JSP 代码 · 共 57 行
JSP
57 行
<%@ page contentType="text/html; charset=gb2312"%>
<%@ include file="verify.jsp" %>
<%@ include file="../share/connection.jsp" %>
<html>
<head>
<title>save passwd</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
String oldpasswd=request.getParameter("oldpasswd");
String newpasswd=request.getParameter("newpasswd");
String renewpasswd=request.getParameter("renewpasswd");
String adminname=request.getParameter("adminname");
if(oldpasswd==null ||oldpasswd.length()==0)
{
out.print("旧密码不能为空");
return;
}
if(newpasswd==null ||newpasswd.length()==0)
{
out.print("新密码不能为空");
return;
}
if(!newpasswd.equals(renewpasswd))
{
out.print("两边密码输入的不一致");
return;
}
String sqlPass="select user_loginname from cs_user where "
+"user_loginname='"+adminname+"' and user_password='"+oldpasswd+"'";
ResultSet rsPass=stm.executeQuery(sqlPass);
if(rsPass.next())
{
sqlPass="update cs_user set user_password='"+newpasswd+"' "
+"where user_loginname='" +adminname+"'";
if(stm.executeUpdate(sqlPass)==1)
{//session.setAttribute("adminpasswd",newpasswd);
//out.print("密码修改成功,请重新登陆!");
session.invalidate();
%>
密码修改成功,请重新<a href="index.jsp" target="_top">登陆</a>!
<%
}
}
else
{
out.print("旧密码输入的不正确");
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?