日期:2014-05-17  浏览次数:20791 次

很简单的问题搞了一个上午,很久没碰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
%>


------解决方案--------------------
try
if not(rs.bof and rs.eof) then
===============
if not rs.bof then


if not(rsa.bof and rsa.eof) then
=================================
if not rsa.bof then
------解决方案--------------------
第一次登录你的yaccount中没有它的记录要用插入,以后登录才能用更新
------解决方案--------------------
....
response.write( "SESSION VALUE: " & session( "username "))
rsa.addnew
rsa( "username ")=session( "username ")
rsa.Update
rsa.Close
set rsa=nothing
end if
------解决方案--------------------
rs.Open "select * from [User] where username= ' "&username& " ' and
------解决方案--------------------
db.mdb的属性-安全性有没有设置匿名账户可修改权限呢?