ASP管理员登陆

来源:百度知道 编辑:UC知道 时间:2024/06/23 16:48:13
guanliyuandenglu.asp
--------------------------------------
<td><h1 align="center" class="STYLE1">管理员登陆</h1></td>
</tr>
<tr>
<td><h2 align="center" class="STYLE1"> </h2></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="guanliyuanpanduan.asp">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100" nowrap="nowrap"><div class="ziti">管理员名:</div></td>
<td width="700"><input name="username" type="text" size="10" /></td>
</tr>
<tr>
<td nowrap="nowrap" class="ziti"><div class="ziti">密码:&

<%
username=request.form("username")
password=request.form("password")
set rsc=server.createobject("adodb.recordset")
sql="select * from login where username='admin' and password ='admin'" '注意这裏改为:
sql="select * from login where username='"&username&"' and password ='"&password&"'"
rsc.open sql,conn,3,3 '注意这裏
if not rsc.eof then
if rsc("username")="admin" and rsc("password")="admin" then
rsc.close
set rsc = nothing
response.redirect("houtai.asp")
end if
else
rsc.close
set rsc = nothing
response.redirect("guanliyuanfail.asp")
end if
conn.close
set conn = nothing
%>

以前学的 现在记得不是很清楚了 只有几点建议

1 在提交页面就要准备检查函数 (当提交表单触发)
主要判断有 数据是否为空 格式是否正确 是否为保留关键字
2 你在查询 select * from log