asp 网页登录代码无法进入
来源:百度知道 编辑:UC知道 时间:2024/06/19 22:59:43
我写的聊天登录界面中无法从index.asp到liaotian.asp,什么地方出错啦!
index页面中部分代码:
<form name="form1" method="post" action="liaotian.asp">
姓名:
<label>
<input name="usname" type="text" id="usname">
</label>
<br>
密码:
<label>
<input name="uspassword" type="text" id="uspassword">
</label>
<br>
<input type="submit" name="Submit" value="进入">
<label>
<input name="reset" type="reset" id="reset" value="重置">
<input name="content" type="hidden" id="reset" value="">
</label>
</form>
liaotian.asp中接受代码:
index页面中部分代码:
<form name="form1" method="post" action="liaotian.asp">
姓名:
<label>
<input name="usname" type="text" id="usname">
</label>
<br>
密码:
<label>
<input name="uspassword" type="text" id="uspassword">
</label>
<br>
<input type="submit" name="Submit" value="进入">
<label>
<input name="reset" type="reset" id="reset" value="重置">
<input name="content" type="hidden" id="reset" value="">
</label>
</form>
liaotian.asp中接受代码:
改:第一行转到用户密码不对页面,
<%
dim conn
dim connstr
connstr="DBQ="+server.mappath("gloab.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("adodb.connection")
conn.Open connstr
name=request.Form("usname")
pass=request.Form("uspassword")
set rs=server.createobject("adodb.recordset")
sql="select * from [user] where name='"&name&"'and password='"&pass&"'"
rs.open sql,conn,3,3
if rs.eof then
Response.Redirect"error.asp"
else
‘liaotian.asp的代码
end if
%>
‘liaotian.asp的代码
liaotian.asp只是一个控制页面,你成功后要到哪里都没写肯定没反应了。
1、试着输出变量SQI,name pass的值,看是否正常.
2、数据库里是否有 name和PASSWORD
if rs.eof then
应该是
if not rs.eof then response.redirect "liaotian.asp"