主题:  登陆时间和IP等更新问题

bnce

职务:普通成员
等级:1
金币:0.0
发贴:59
注册:2002/11/6 15:56:56
#12003/6/21 16:10:04
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>


<%
if(Request.QueryString("user") <> "") then Command1__MMColParam = Request.QueryString("user")

%>
<%
dim a_ip
dim a_time

a_ip = request.ServerVariables("REMOTE_ADDR")
a_time= now()

if request.form("Submit")="确定" then
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_goodluck_STRING
Command1.CommandText = "UPDATE admin SET a_time =a_time, a_ip =a_ip WHERE a_admin = " + Replace(Command1__MMColParam, "'", "''") + " "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
end if
%>

<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("user"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="a_level"
MM_redirectLoginSuccess="administrator/index.asp"
MM_redirectLoginFailed="#"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_goodluck_STRING
MM_rsUser.Source = "SELECT a_admin, a_password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM admin WHERE a_admin='" & Replace(MM_valUsername,"'","''") &"' AND a_password='" & Replace(Request.Form("password"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>



无标题文档
















红色部分是我自己加的,就想点击登陆的时候把a_time和a_ip这两个值写进表中,但是现在的情况好象这段代码并没有被激活,登陆后没有数据写入,请大家帮忙看看



今晚在线

职务:普通成员
等级:3
金币:1.0
发贴:761
注册:2001/8/8 19:12:36
#22003/6/21 21:33:42
试试

UPDATE admin SET a_time ='" & a_time & "', a_ip = '" & a_ip & "'………………"