asp+access 判断用户是否存在+代码
我是想在网站上加个找回密码。asp+access数据库输入一个用户查看用户是否存在。如果存在进去下一步如果不存在提示**用户名不存在...
我是想在网站上加个找回密码。asp+access数据库输入一个用户 查看用户是否存在。如果存在进去下一步 如果不存在提示**用户名不存在
展开
2013-07-25
展开全部
pwd.asp
<!--#i nclude file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td><p>找回密码</p>
<form name="form1" method="post" action="pwd2.asp?action=pwd">
<table width="398" border="1" cellpadding="5" cellspacing="0">
<tr>
<td width="130">请输入用户名</td>
<td width="168"><input name="name" type="text" id="name"></td>
<td width="62"><input type="submit" name="submit" value="查询"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
pwd2.asp
<!--#i nclude file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td>
找回密码
<%
name=trim(request.form("name"))
set rs=server.createobject("adodb.recordset")
sql="select * from user where name='"&name&"'"
rs.open sql,conn,1,1
if not rs.eof then
%>
<form name="form1" method="post" action="pwd3.asp">
<table width="398" border="1" cellpadding="5" cellspacing="0">
<tr>
<td><%=rs("name")%></td>
<td> </td>
<td><input name="name" type="hidden" id="name" value="<%=rs("name")%>"></td>
</tr>
<tr>
<td width="130">密码提示问题</td>
<td width="168"><%=rs("wenti")%>
</td>
<td width="62"> </td>
</tr>
<tr>
<td>密码提示答案</td>
<td><input name="daan" type="text" id="daan"></td>
<td><input type="submit" name="submit" value="查询"></td>
</tr>
</table>
</form>
<% else
%>
<table width="413" border="1" cellpadding="5" cellspacing="0">
<tr>
<td>你输入的用户名不存在,请<a href="/webjx/"";javascript:history.back()">返回</a>重新输入,或者<a href="/webjx/"";reg.asp">注册</a></td>
</tr>
</table>
<%end if
%>
</td>
</tr>
</table>
</body>
</html>
pwd3.asp
<!--#i nclude file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td>
找回密码
<%
name=trim(request.form("name"))
daan=trim(request.form("daan"))
set rs=server.createobject("adodb.recordset")
sql="select * from user where name='"&name&"' and daan='"&daan&"'"
rs.open sql,conn,1,1
if not rs.eof then
%>
<table width="398" border="1" cellpadding="5" cellspacing="0">
<tr>
<td width="130"><%=rs("name")%>,您的密码</td>
<td><%=rs("pwd")%>
</td>
</tr>
</table>
<% else
%>
<table width="413" border="1" cellpadding="5" cellspacing="0">
<tr>
<td>你输入的密码提示答案不正确,请<a href="/webjx/"";javascript:history.back()">返回</a>重新输入</td>
</tr>
</table>
<%end if
%>
</td>
</tr>
</table>
</body>
</html>
<!--#i nclude file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td><p>找回密码</p>
<form name="form1" method="post" action="pwd2.asp?action=pwd">
<table width="398" border="1" cellpadding="5" cellspacing="0">
<tr>
<td width="130">请输入用户名</td>
<td width="168"><input name="name" type="text" id="name"></td>
<td width="62"><input type="submit" name="submit" value="查询"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
pwd2.asp
<!--#i nclude file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td>
找回密码
<%
name=trim(request.form("name"))
set rs=server.createobject("adodb.recordset")
sql="select * from user where name='"&name&"'"
rs.open sql,conn,1,1
if not rs.eof then
%>
<form name="form1" method="post" action="pwd3.asp">
<table width="398" border="1" cellpadding="5" cellspacing="0">
<tr>
<td><%=rs("name")%></td>
<td> </td>
<td><input name="name" type="hidden" id="name" value="<%=rs("name")%>"></td>
</tr>
<tr>
<td width="130">密码提示问题</td>
<td width="168"><%=rs("wenti")%>
</td>
<td width="62"> </td>
</tr>
<tr>
<td>密码提示答案</td>
<td><input name="daan" type="text" id="daan"></td>
<td><input type="submit" name="submit" value="查询"></td>
</tr>
</table>
</form>
<% else
%>
<table width="413" border="1" cellpadding="5" cellspacing="0">
<tr>
<td>你输入的用户名不存在,请<a href="/webjx/"";javascript:history.back()">返回</a>重新输入,或者<a href="/webjx/"";reg.asp">注册</a></td>
</tr>
</table>
<%end if
%>
</td>
</tr>
</table>
</body>
</html>
pwd3.asp
<!--#i nclude file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td>
找回密码
<%
name=trim(request.form("name"))
daan=trim(request.form("daan"))
set rs=server.createobject("adodb.recordset")
sql="select * from user where name='"&name&"' and daan='"&daan&"'"
rs.open sql,conn,1,1
if not rs.eof then
%>
<table width="398" border="1" cellpadding="5" cellspacing="0">
<tr>
<td width="130"><%=rs("name")%>,您的密码</td>
<td><%=rs("pwd")%>
</td>
</tr>
</table>
<% else
%>
<table width="413" border="1" cellpadding="5" cellspacing="0">
<tr>
<td>你输入的密码提示答案不正确,请<a href="/webjx/"";javascript:history.back()">返回</a>重新输入</td>
</tr>
</table>
<%end if
%>
</td>
</tr>
</table>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-25
展开全部
表单中用户名文本框叫:usename提交表单后的处理表单代码如下:set rs = server.creatobject("adodb.recordset")sql = "select * from usetable where usename="&request.form("usename")rs.open sql,conn,1,1if rs.eof thenresponse.redirect "nextpage" '进入下一步elseresponse.write "用户名不存在。"end ifrs.closeset rs = nothing
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询