请教一个登陆错误

cboy2003 2003-09-19 03:19:47
下面是登陆页的代码,提示出错在第六行。
这个站是网上都有的my12345,我把sql转成了access,系统基本正常,这后台就是登陆不上,网站浏览正常
<!--#include file="public.inc"-->
<%
function Enc(str)
dim strtmp
for i=1 to len(str)
strtmp = strtmp & right("000"&(asc(mid(str,i,1)) xor request.Cookies("Ext")),3)
next
Enc = strtmp
end function
function Dec(str)
dim strtmp
for i=1 to len(str)\3
strtmp = strtmp & chr(cint(mid(str,(i-1)*3+1,3)) xor request.Cookies("Ext"))
next
Dec = strtmp
end function
%>


<%
Sub ShowLogin()
validateconn()
AuthCode2 = ""
rs.open "select ParaValue from tab_systemparas where ParaName='AuthCode'",conn
if not rs.eof then
AuthCode2 = rs("ParaValue")
end if
rs.close

if request.Cookies("Ext")="" then
randomize()
response.Cookies("Ext") = cint(rnd()*100)
response.Cookies("Ext").Domain = "www.my12345.com"
response.Cookies("Ext").Expires = date+365
end if

CookAuth = Dec(request.Cookies("AuthCode"))
if CookAuth <> AuthCode2 then
randomize()
response.Cookies("Ext") = cint(rnd()*100)
response.Cookies("Ext").Domain = "www.my12345.com"
response.Cookies("Ext").Expires = date+365
end if
%>
<html>
<head>
<title>用户登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="cover.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" onload="javascript:document.form1.UserXM.focus();">

<script language=javascript>
function submit()
{
if (0 == document.form1.UserXM.value.length)
{
alert("请输入您的账号!");
document.form1.UserXM.focus();
}
else
if (document.form1.UserXM.value.indexOf("'")>=0 || document.form1.UserMM.value.indexOf("'")>=0)
alert("非法字符[ ' ]")
else
document.form1.submit();
}

function before_submit()
{
if (0 == document.form1.UserXM.value.length)
{
alert("请输入您的账号!");
document.form1.UserXM.focus();
return false;
}
else
if (document.form1.UserXM.value.indexOf("'")>=0 || document.form1.UserMM.value.indexOf("'")>=0)
{
alert("非法字符[ ' ]");
return false;
}
return true;
}
</script>

<form name=form1 action="index.asp?from=self&go_to=<%=request("go_to")%>" method=post onsubmit="javascript:return before_submit();">

<table width="90%" border="0" align="center" height="216">
<tr>
<td colspan="3" height="100"> </td>
</tr>
<tr>
<td colspan="3"> <div align="center"><b><font color="green">用户登录</font></b></div></td>
</tr>
<tr>
<td colspan="3"> <hr width="60%" align="center" color="#3366ff" noshade>
</td>
</tr>
<tr>
<td width="38%"> <div align="right"><font color="#3366FF" size="-1">账 号:</font></div></td>
<td width="26%"> <div align="center"> <font size="-1">
<input type="text" name="UserXM">
</font></div></td>
<td width="36%"><font size="-1"> </font></td>
</tr>
<tr>
<td width="38%"> <div align="right"><font color="#3366ff" size="-1">密 码:</font></div></td>
<td width="26%"> <div align="center"> <font size="-1">
<input type="password" name="UserMM">
</font></div></td>
<td width="36%"><font size="-1"> </font></td>
</tr>
<%
if CookAuth <> AuthCode2 then
%>
<tr>
<td align="right"><font color="#3366FF">认证码:</font></td>
<td align="center"><font size="-1">
<input name="UserAuth" type="password" id="UserAuth">
</font></td>
<td> </td>
</tr>
<%
end if
%>
<tr>
<td colspan="3" height="4"> <hr width="60%" align="center" color="#3366ff" noshade>
</td>
</tr>
<tr>
<td width="38%" height="14"> <div align="right"><font size="-1"></font></div></td>
<td width="26%" height="14"> <div align="center"><font size="-1"><a href="javascript:submit()">确定登录</a>
<input type="image" border="0" name="imageField" src="images/ico.gif" width="20" height="20">
<a href="javascript:document.form1.reset()">重新填写</a></font> </div>
<input type="hidden" name="login" value="true"> </td>
<td width="36%" height="14"><font size="-1"> </font></td>
</tr>
</table>
</form>
</body>
</html>
<%
End Sub

Sub Login()

validateconn()

if request("login")="true" then

'取得认证码
rs.open "select * from tab_systemparas where ParaName='AuthCode'",conn,3
if not rs.eof then
AuthCode = rs("ParaValue")
end if
rs.close

CookAuthCode = Dec(request.Cookies("AuthCode"))

if AuthCode<>request("UserAuth") and AuthCode<>CookAuthCode then
response.write "<script language=javascript>alert(""认证码错误!"");window.location='index.asp';</script>"
response.end
end if

'保存认证码
response.Cookies("AuthCode") = Enc(AuthCode)
'response.Cookies("AuthCode").Domain = "www.my12345.com"
response.Cookies("AuthCode").Expires= date+365

rs.open "select * from tab_users where UserName='"&request("UserXM")&"' and UserPwd='"&request("UserMM")&"'",conn,3
if rs.eof then
response.write "<script language=javascript>alert(""密码错误!"");window.location='index.asp';</script>"
response.end
end if

session("userid")=request("UserXM")
session("UserPwd")=request("UserMM")
session("UserRole")=rs.fields("UserRole")
session("UserCode")=rs.fields("UserCode")

if request("go_to")="" then
response.write "<script language=javascript>window.location='frame.asp';</script>"
response.end
else
response.write "<script language=javascript>window.location="""&request("go_to")&"""</script>"
response.end
end if
end if
End Sub

session("userid")=""
session("UserPwd")=""
session("UserRole")=""
if request("from")="self" then
Login
else
ShowLogin
end if
%>
...全文
19 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hfkj 2003-09-19
  • 打赏
  • 举报
回复
是不是在转换数据库时出现了问题
比如说:字段类型等一些常见的问题
61 2003-09-19
  • 打赏
  • 举报
回复
打出你的数据库连接代码

28,391

社区成员

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

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