|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
(ASP)登陆页面的问题``谢谢小菜的问题
我想做最简单的登陆页面~~~ 就是不对~~那位高手帮我看看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form name="form1" method="post" action="c.asp">
<%
db_path = "db1.mdb"
Set conn= Server.CreateObject("ADODB.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db_path)
conn.Open connstr
dim youhuming,mima
youhuming=request.form("youhuming")
mima=request.form("mima")
%>
<table width="450" border="1" align="center">
<tr align="center">
<td height="30" colspan="2">留言板登陆</td>
</tr>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from denglu",conn,1,3
%>
<tr>
<td width="131" height="40" align="center">用户名:</td>
<td width="307"><input name="youhuming" type="text" size="18" value="<%=youhuming%>"<%if youhuming=rs("yonghuming") then response.redirect("c.asp") else response.write("<script>alert('请重输入');history.back();</script>")%>></td>
</tr>
<tr>
<td height="40" align="center">密码:</td>
<td><input name="mima" type="password" size="18" value="<%=mima%>"<%if mima=rs("mima") then response.redirect("c.asp") else response.write("<script>alert('请重输入');history.back();</script>")%>></td>
</tr>
<%
rs.update
rs.close
%>
<tr align="center">
<td height="30" colspan="2"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>
|
登陆页面:
<FORM action="chkuslogin.asp" method=POST onsubmit="return docheck()" name="loginForm">
<TABLE cellSpacing=5 cellPadding=0 width=181 align=center
border=0>
<TBODY>
<TR>
<TD align=left width=52>用 户 名</TD>
<TD align=left colSpan=2><INPUT
maxLength=20 size=15 name=username></TD>
</TR>
<TR>
<TD align=left>密 码</TD>
<TD align=left colSpan=2><INPUT
type=password maxLength=20 size=15 name=password></TD>
</TR>
<TR>
<TD nowrap>验 证 码</TD>
<TD width=70><INPUT name=verifycode id="verifycode" value="<%If GetCode=9999 Then Response.Write "9999"%>"
size=8 maxLength=4></TD>
<TD align=left width=57><IMG
src="GetCode.asp"></TD>
</TR>
<TR>
<TD colSpan=3 height=30><TABLE cellSpacing=0 cellPadding=0 width=178 border=0>
<TBODY>
<TR>
<TD width=124
height=30> <a href="agreements.asp">新用户注册</a> <a href="getpass.asp">忘记密码</a></TD>
<TD width=2></TD>
<TD align=middle><INPUT align=bottom name=userlogin border=0 src="img/confirm.jpg" type=image style="cursor:hand; "></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
</form>
检测页面:
<%dim username,password,verifycode
username=replace(trim(request("username")),"'","")
password=md5(replace(trim(request("password")),"'",""))
verifycode=replace(trim(request("verifycode")),"'","")
if username="" or password="" then
response.Write "<script LANGUAGE='javascript'>alert('您的管理ID或密码有误!');history.go(-1);</script>"
response.end
end if
if cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from ps where username='"&username&"' and password='"&password&"' AND SH=1 " ,conn,1,3
if not(rs.bof and rs.eof) then
if password=rs("password") then
session.Timeout=999
rs("login")=rs("login")+1
rs.update
rs.Close
set rs=nothing
'response.Redirect "index.asp"
if request("linkaddress")="" then
response.redirect request.servervariables("http_referer")
else
response.redirect request("linkaddress")
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起,用户名或密码错误,请重新登陆!');history.go(-1);</script>"
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起,用户名或密码错误,请重新登陆!');history.go(-1);</script>"
end if
%> |
谢谢啊 |
|