为什么转成SQL数据库后,登陆会员和注册会员都写不进SQL数据库呢? 1、登陆会员时,就无法查询数据库的用户名,其实是有这个用户的,但ASP却显示出来没有找到此用户。 2、注册会员时,也是没有把新会员写进SQL数据库里面,注册不到会员。还有,注册时,SQL数据库根本没有此会员,ASP输出显示:已经有此会员存在,请选择其他用户名。。也就是现在问的都是注册不到,查询不到SQL数据库。
调试欢乐多
<!--#include file="conn.asp"-->
<%
function Checkin(s)
s=trim(s)
s=replace(s," ","&nbsp;")
s=replace(s,"'","&#39;")
s=replace(s,"""","&quot;")
s=replace(s,"<","&lt;")
s=replace(s,">","&gt;")
Checkin=s
end function founderr=falsesub error()
%>
<html><head><title>错误信息</title>
<LINK href="CSS.css" type=text/css rel=stylesheet>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="center">
<TABLE cellSpacing=0 cellPadding=0 width="470" border=0 height="26">
<TR>
<td><font color="#FF0000"> 错误信息:</td></tr>
</table>
<table border="0" width="468" cellspacing="0" cellpadding="0" height="56">
<tr>
<td width="99%" height=54 align="left" style="padding: 0" bgcolor="#F7F7F7" bordercolor="#999999">错误原因:<%=errmsg%></td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width="470" border=0 bgcolor="#899EC7" height="25">
<TR>
<th bgcolor="#FFFFFF">
<p align="left"><a href="javascript:history.go(-1)">
<span style="font-weight: 400; text-decoration: none"><font color="#808080"><< 返回上一页</font></span></font></a></th>
</div>
</TD></TR>
</TABLE>
</center>
</body>
</html>
<%
end subUserIP=Request.ServerVariables("REMOTE_ADDR")
if request("username")="" then
response.write "<script language=javascript>window.alert('请输入用户名,然后再登陆!!!');history.back(1);</script>"
Response.End
else
username=Checkin(trim(request("username")))
end if
if request("password")="" then
response.write "<script language=javascript>window.alert('请输入密码,然后再登陆!!!');history.back(1);</script>"
Response.End
else
password=Checkin(trim(request("password")))
end if
if request("validatecode")="" or request("validatecode")<>Session("cnbruce.com_ValidateCode") then
response.write "<script language=javascript>window.alert('验证码不正确!请仔细输入!');history.back(1);</script>"
Response.End
else
validatecode=Checkin(trim(request("validatecode")))
end if
set rs=server.createobject("adodb.recordset")
sql="select username,password,logins,lastlogin,loginIP,points,IsVip from user where username='"&username&"' and lockuser=0"
rs.open sql,conn,1,3
if rs.bof and rs.eof then
errmsg=errmsg+"<br>"+"<li>请检查是否输入错误,如果是您还没有注册,<a href='UserReg.asp'>请先注册</a>"
founderr=true
else
if rs("password")<>password then
errmsg=errmsg+"<br>"+"<li>您输入的密码不正确。"
founderr=true
else
lastlogin=rs("lastlogin")
if DateDiff("s",lastlogin,Now())<60 then
thislogin=120-DateDiff("s",lastlogin,Now())
response.write "<script language=javascript>window.alert('本站限制每次登陆时间的间隔为60秒!\n您还要再等"&thislogin&"秒!');history.back(1);</script>"
Response.End
else
rs("logins")=rs("logins")+1
if rs("IsVip")=1 then
rs("points")=rs("points")+10
else
rs("points")=rs("points")+5
end if
rs("lastlogin")=Now()
rs("loginIP")=Request.ServerVariables("REMOTE_ADDR")
rs.update
session("DJUser")=UserName
session("DJUserPwd")=PassWord
end if
end if
end if
if founderr=true then
call error()
else
if err.number<>0 then
Response.write ("数据库操作失败:"&err.description)
Response.End
end if
response.redirect("xx.asp")
end if
%>