帮忙找找这个登录代码在哪出错?

boomyear 2010-08-07 10:51:35
出错现象:登录后在loginchk.asp页面出错,无法进入首页。不知道是哪出了问题。
下面附上conn.asp,index.asp,loginchk.asp三个文件的代码。


'--------------------conn.asp
<%
dim conn,mydb,startime,db,rs,UserAgent
db="adminuser/dada/#9idns_Data.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
mydb="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
Conn.Open Mydb
%>
<%

UserAgent = Trim(Lcase(Request.Servervariables("HTTP_USER_AGENT")))
If InStr(UserAgent,"teleport") > 0 or InStr(UserAgent,"webzip") > 0 or InStr(UserAgent,"flashget")>0 or InStr(UserAgent,"offline")>0 Then
Response.Write "请不要采用teleport/Webzip/Flashget/Offline等工具来浏览网站!"
Response.End
End If

ThisFilePath=Request.ServerVariables("PATH_INFO")
ThisFileName=lcase(Mid(ThisFilePath,InstrRev(ThisFilePath,"/")+1)) '获取本文件的名字
PPst_Path="PPst_UpLoadFile" '前后都不能带/
PPst_Path0=Replace(ThisFilePath,Mid(ThisFilePath,InstrRev(ThisFilePath,"/")+1),"")&PPst_Path '原始大小写保持不变
PPst_Path1=Replace(lcase(ThisFilePath),ThisFileName,"")&PPst_Path '全部小写

Function PPst_Save(Content)
PPst_Save=Replace(Replace(Content,PPst_Path0,PPst_Path1),PPst_Path1,PPst_Path)
End Function
Function PPst_Get(Content)
PPst_Get=Replace(Content,PPst_Path,PPst_Path1)
End Function

Function HtmlCode(HtmlStiring) '定义一个简单的HTML代码替换函数
HtmlStiring=Replace(HtmlStiring,"<","<")
HtmlStiring=Replace(HtmlStiring,">",">")
HtmlStiring=Replace(HtmlStiring,VBCrlf,"<br>")
HtmlStiring=Replace(HtmlStiring," "," ")
HtmlCode=HtmlStiring
End Function

Function TitleLeft(str,strlen) '函数,将汉字计算为两个字符
Dim l,t,c, i
l=len(str)
t=0
For i=1 to l
c=Abs(Asc(Mid(str,i,1)))
If c>255 then
t=t+2
Else
t=t+1
End if
If t>=strlen then
TitleLeft=left(str,i)&".."
Exit for
Else
TitleLeft=str&""
End If
Next
End Function
%>



'----------------------------------------------index.asp
<!--#include file="conn.asp"-->

<table width="170" border="0" cellpadding="0" cellspacing="0">
<form id="form1" name="form1" method="post" action="mumber/loginchk.asp" onsubmit="return xxg()">
<tr>
<td width="61" height="25" align="center" >用户名:</td>
<td width="109" align="left"><input name="username" type="text" class="top_input" id="username" style="width:100px;" /></td>
</tr>
<tr>
<td height="25" align="center">密 码:</td>
<td align="left"><input name="password" type="password" class="top_input" id="password" style="width:100px;" /></td>
</tr>
<tr>
<td height="25" align="center" >验证码:</td>
<td align="left"><input name="Verifycode" type="text" id="Verifycode" style="width:40px;height:14px;border:1px solid #cccccc" />
 <b><%=s%></b>
<input name="slogin" type="hidden" id="slogin" value="<%=s%>" size="12" maxlength="20" /></td>
</tr>
<tr>
<td height="25" align="center"> </td>
<td align="left"><input type="image" name="imageField" src="images/user.gif" style="height:18px;" /></td>
</tr>
<tr>
<td height="40" colspan="2" align="center" >如果您想加入本站会员<br />
请点击<a href="reguser.asp"><font color="#FF0000">会员注册</font></a></td>
</tr>
</form>
</table>



'----------------------- loginchk.asp
<!--#include file="../conn.asp" -->
<!--#include file="../include/md5.asp" -->
<%
s=Trim(Request.Form("slogin"))
s2=Request.Form("Verifycode")
If s2<>s Then
Response.Write("<script language=javascript>alert('请输入正确的认证码!');history.back()</script>")
Response.End
end if
'====================================
LoginName=replace(trim(request.form("username")),"'","''")
LoginPassword=Md5(replace(trim(request.form("password")),"'","''"))
'====================检测姓名中是否含有非法字符开始
if instr(username,"%") or instr(username,"#") or instr(username,"?") or instr(username,"|") then
response.write "<script language=javascript>alert('您的姓名含有非法字符!');history.back()</script>"
response.end
end if
'====================检测姓名中是否含有非法字符end

if instr(password,"%") or instr(password,"#") or instr(password,"?") or instr(password,"|") then
response.write "<script language=javascript>alert('您的密码含有非法字符!');history.back()</script>"
response.end
end if
'====================检测密码中是否含有非法字符

set rs=server.createobject("adodb.recordset")

rs.open "select * from [user] where username='"&LoginName&"'",conn,1,3
if rs.eof then
response.write "<script language=javascript> alert('用户名称不正确,请重新输入。');history.back();</script>"
response.end
else
username=rs("username")
Password=rs("Password")
end if

if LoginPassword<>Password then
response.write "<script language=javascript> alert('密码不正确,请重新输入。');history.back();</script>"
response.end
end if

if LoginName=username and LoginPassword=Password then
rs("logintime")=now()
rs("loingIP")=Request.ServerVariables("Remote_Addr")

session("uusername")=rs("username")
session("xingming")=rs("xingming")
session("uuserid")=rs("id")
Response.Cookies("uusername") = rs("username")
Response.Cookies("uusername").Expires=date()+365
rs.update
session.timeout=30
rs.close
set rs=nothing
'==================================

response.redirect "index.asp"
response.end
end if

conn.close
set conn=nothing
%>
...全文
67 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
boomyear 2010-08-07
  • 打赏
  • 举报
回复
感谢sy_binbin!送上40分廖表谢意
boomyear 2010-08-07
  • 打赏
  • 举报
回复
OK了,先是conn数据库 路径错误,少了一个../
然后是SQL语句rs.open "select * from [user] where username='"&LoginName&"'",conn,1,3
其中的USER加个【】
叫我梁大侠 2010-08-07
  • 打赏
  • 举报
回复
路过学习下
sy_binbin 2010-08-07
  • 打赏
  • 举报
回复
好了!错误信息已经出来了!
那你就看wwwroot\11\mumber\loginchk.asp这个文件里的72行前后的代码有啥问题吧
boomyear 2010-08-07
  • 打赏
  • 举报
回复
Microsoft JET Database Engine '80004005'

'C:\Program Files\小旋风AspWebServer\wwwroot\11\mumber\adminuser\dada\#9idns_Data.mdb'不是一个有效的路径。 确定路径名称拼写是否正确,以及是否连接到文件存放的服务器。

\wwwroot\11\conn.asp, line 10



数据库路径错误???这目录没错呀。
boomyear 2010-08-07
  • 打赏
  • 举报
回复
Microsoft VBScript 编译器错误 '800a03f6'

缺少 'End'

\wwwroot\11\mumber\loginchk.asp, line 72
sy_binbin 2010-08-07
  • 打赏
  • 举报
回复
浏览器-工具-internet选项-高级-显示友好http错误信息这项给去掉

看看错误信息是啥
boomyear 2010-08-07
  • 打赏
  • 举报
回复
错误提示如下:

网站无法显示该页面

最可能的原因是:
•该网站正在进行维护。
•该网站有程序错误。

您可以尝试以下操作:
刷新该网页。

返回到上一页。



sy_binbin 2010-08-07
  • 打赏
  • 举报
回复
错误信息是啥?

28,390

社区成员

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

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