请各位帮忙帮忙!!!

jackycxg 2003-11-02 09:09:00
我刚用asp(初学asp)做的“用户登录”栏。怎么调试都不会出来,现附代码于下,请各位帮忙查看一下是那步出了问题。还有在index.asp页中应该怎么写代码。等待!!!
index.asp中代码如下:
<form name="form1" method="post" action="page/denglu.asp">
<table width="163" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="62"><div align="right"><font size="2">用户名:</font></div></td>
<td width="101" height="22"> <input name="username" type="text" id="username" size="12">
</td>
</tr>
<tr>
<td><div align="right"><font size="2">密  码:</font></div></td>
<td height="23">
<input name="password" type="password" id="password" size="12">
</td>
</tr>
<tr>
<td height="28" colspan="2"> <div align="center">
<input type="submit" name="Submit" value="会员请进" style=background-color:"#FEBA69" onclick=datacheck>
</div></td>
</tr>
</table>
</form>
在登录页中的代码如下:
<%@ LANGUAGE = "VBScript" %>
<%
function checklogin(login,password)
set cnndb=server.CreateObject("adodb.connection")
strcon="provider=microsoft.jet.oledb.4.0;data source="& _ server.MapPath("../database/class.mdb")
cnndb.open strcon
set rstlogin=server.CreateObject("adodb.recordset")
strsql="select*from login " & _ "where 用户名='" & login & "'"
rstlogin.open strsql,cnndb
if rstlogin.eof then
checklogin="无此用户名"
elseif rstlogin("密码") <> password then
checklogin="密码错误"
else
checklogin="成功登录"
endif
end function
username=request("username")
userpassword=request("userpassword")
strchecklogin=checkloing(username,userpassword)
if strchecklogin="成功登录" then
session("username") = request("username")
session("userpassword") = request("userpassword")
response.Redirect("page/dengluchenggong.asp)
end if
%>
<html>
<head>
<title>用户登录</title>
</head>
<body>
<center>
<font size= 5 color=blue>用户登录</font>
</center>
<hr>
<center>
<% strchecklogin %><a href="index.asp">请重新登录</a>
</center>
</body>
</html>
请各位帮忙检查一下是哪里出了 问题,或者是代码的位置放错了!???
...全文
42 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dafei0320 2003-11-02
  • 打赏
  • 举报
回复
还有在读取数据库之前login要定义了!
login=request("username")其他也是
dafei0320 2003-11-02
  • 打赏
  • 举报
回复
strsql="select*from login where 用户名='" & login & "'"
看看是不是数据库读错了?

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧