📄 repassword.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="con" scope="page" class="numb1.com.db"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改密码</title>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
function check_form(theform)
{
if (theform.mm0.value=="")
{
alert("请输入您的旧密码!");
theform.mm0.focus();
return false;
}
if (theform.mm0.value.length<4)
{
alert("请正确输入原密码!");
theform.mm0.focus();
return false;
}
if (theform.mm1.value.length<4)
{
alert("新密长度不得小于4位!");
theform.mm1.focus();
return false;
}
if (theform.mm1.value=="")
{
alert("请输入您的新密码!");
theform.mm1.focus();
return false;
}
if (theform.mm1.value!=theform.mm2.value)
{
alert("您两次输入的密码不一致!");
theform.mm1.focus();
return false;
}
if (theform.mm1.value==theform.mm0.value)
{
alert("新旧密码一样,您不需要进行这一步操作");
theform.mm1.focus();
return false;
}
}
</script>
</head>
<body>
<%
String id=(String)session.getAttribute("id");
String mm1=request.getParameter("mm1");
String mm0=request.getParameter("mm0");
String again=request.getParameter("again");
String sql;
sql="select*from numb1 where userid='"+id+"' and pw='"+mm0+"'";
ResultSet rs=con.query(sql);rs.next();
if(rs.getRow()!=0){
if(mm1.length()>3){
sql="update numb1 set pw='"+mm1+"' where userid='"+id+"'";
con.update(sql);
out.print("<table width=\"300\" border=\"0\" align=\"center\"><tr><td><font color=\"#FF0000\"><center>修改成功,<a href=\"javascript:window.close()\">关闭</a>即可生效</center></font></td></tr></table>");
}else{
out.print("<br><br><table width=\"360\" border=\"0\" align=\"center\"><tr><td><font color=\"#FF0000\"><center><b>您的密码长度不够,请<a href=\"javascript:history.back()\">重新设置</a></b></center></font></td></tr></table>");
}
}else{
if(again!=null){out.print("<table width=\"300\" border=\"0\" align=\"center\"><tr><td><font color=\"#FF0000\"><center>您输入的旧密码不正确,请重新输入</center></font></td></tr></table>");}
%>
<form name="form1" method="post" action="repassword.jsp" onSubmit="return check_form(this)">
<table width="300" border="0" align="center" cellspacing="1" bgcolor="#7188e0">
<tr bgcolor="#f8f8f8">
<th colspan="2"><table width="100%" border="0" cellspacing="1">
<tr>
<th bgcolor="#7188e0"><span class="style1">修 改 密 码</span></th>
</tr>
</table>
</th>
</tr>
<tr bgcolor="#f8f8f8">
<td width="86" height="20"><div align="right">旧密码:</div></td>
<td width="198"> <input name="mm0" type="password" id="mm0" size="16" style="BORDER: #ACACFF 1px solid;color:#1818FF;">
</td>
</tr>
<tr bgcolor="#f8f8f8">
<td height="20"><div align="right">新密码:</div></td>
<td> <input name="mm1" type="password" id="mm1" size="16" style="BORDER: #ACACFF 1px solid;color:#1818FF;"></td>
</tr>
<tr bgcolor="#f8f8f8">
<td height="20"><div align="right">确认密码:</div></td>
<td> <input name="mm2" type="password" id="mm2" size="16" style="BORDER: #ACACFF 1px solid;color:#1818FF;"></td>
</tr>
<tr bgcolor="#f8f8f8">
<th height="30" colspan="2" valign="bottom"><input name="imageField" type="image" src="img/ok1.gif" width="60" height="22" border="0" onMouseOut="this.src='img/ok1.gif'" onMouseOver="this.src='img/ok2.gif'">
<input name="again" type="hidden" id="again" value="y">
<img src="img/close1.gif" width="60" height="22" onClick="window.close();"onMouseOut="this.src='img/close1.gif'" onMouseOver="this.src='img/close2.gif'" style="cursor:hand"></th>
</tr>
</table>
</form>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -