📄 findpass.jsp
字号:
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>找回密码</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
<!--
.style1 {
font-size: 24px;
font-family: "华文隶书";
color: #FF0000;
}
body,td,th {
color: #0000CC;
font-size: 18px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<p>
<%
String driverName="com.mysql.jdbc.Driver";
String userName="root";
String userPasswd="ptnest";
String url ="jdbc:mysql://127.0.0.1/bookstore?useUnicode=true&characterEncoding=gb2312" ;
try
{
Class.forName(driverName);
}
catch(ClassNotFoundException e)
{
System.out.print("数据库类没有找到"+e.getMessage());
}
Connection conn= DriverManager.getConnection(url,userName,userPasswd);
Statement stmt=conn.createStatement();
%>
<%!String logname,problem,answer;
boolean loginAttempt=false;
String errorMessage="" ;%>
<%
if(request.getParameterValues("logname")!=null&&request.getParameterValues("problem")!=null&&request.getParameterValues("answer")!=null)
{
loginAttempt=true;
}
if(loginAttempt)
{
logname=new String(request.getParameter("logname"));
problem=new String(request.getParameter("problem"));
answer=new String(request.getParameter("answer"));
String sql="select *from user where name='"+logname+"' and quesstion='"+problem+"' and answer='"+answer+"'";
int rowscount=0;
try
{
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{
rowscount++;
errorMessage=rs.getString("pass");
}
}
catch(Exception e)
{
e.toString();
}
if(rowscount==0)
{
errorMessage="您的提示问题或者回答问题不正确,请重新输入";
}
}
%>
</p>
<table width="965" height="27" border="0">
<tr>
<td bgcolor="#FF9933"><div align="center" class="style1">找回密码</div></td>
</tr>
</table>
<form name="form1" method="post" action="">
<p> </p>
<table width="351" height="154" border="0" align="center">
<tr bordercolor="#33CC00" bgcolor="#00FF99">
<td width="160"><div align="right">登陆名:</div></td>
<td width="181"><input type="text" name="logname"></td>
</tr>
<tr bordercolor="#33CC00" bgcolor="#00FF99">
<td><div align="right">密码提示问题:</div></td>
<td><input name="problem" type="text" id="problem"></td>
</tr>
<tr bordercolor="#33CC00" bgcolor="#00FF99">
<td><div align="right">密码提示答案:</div></td>
<td><input name="answer" type="text" id="answer"></td>
</tr>
<tr bordercolor="#33CC00" bgcolor="#00FF99">
<td> </td>
<td><input type="submit" name="Submit" value="找回密码"></td>
</tr>
<tr bordercolor="#33CC00" bgcolor="#00FF99">
<td><div align="right">您的密码是:</div></td>
<td> <%=errorMessage%></td>
</tr>
</table>
<p> </p>
</form>
<p align="center"><a href="files/relogin.html">返回登陆</a></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -