很简单的问题搞了一个上午,很久没碰ASP了,帮我看看吧
问题:我需要在登录的时候,用户第一次登录成功后,同时把用户名更新到表 yaccount(不是用户注册时候的表) 中,之后转到user.asp,但现在问题,已经更新到yaccount的用户(我自己加进去的)再次登录就可以转到 user.asp ,第一次登录的用户,yaccount中usname也没有更新,也没有跳转,验证页:check.asp 一片空白,什么也没有,帮我看看吧,怎么写?
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from User where username='"&username&"' and password1='"&userpassword&"' " ,conn,1,3
if not(rs.bof and rs.eof) then
if userpassword=rs("password1") then
session("username")=rs("username")
session("regid")=rs("id")
rs("lastlogin")=now()
rs("endip") = Request.ServerVariables("REMOTE_ADDR")
rs.Update
rs.Close
set rs=nothing
set rsa=server.CreateObject("adodb.recordset")
rsa.Open "select * from yaccount where userid="&session("regid")&"",conn,1,3
if not(rsa.bof and rsa.eof) then
response.redirect "user.asp"
else
rsa.addnew
rsa("username")=session("username")
rsa.Update
rsa.Close
set rsa=nothing
end if
response.redirect "user.asp"
else
response.write "<script LANGUAGE='javascript'>alert('对不起,您的用户名或密码有误!');history.go(-1);</script>"
end if
end if
%>