asp的一段代码,要取得对应用户名的ID号,帮忙看下下面的代码应该怎么做
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%><%'***Validaterequesttologintothissite.MM_Login...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
' *** 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("a_username"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="a_level"
MM_valUserid="a_id"
MM_redirectLoginSuccess="frame.asp"
MM_redirectLoginFailed="error.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_conn_bargain_STRING
MM_rsUser.Source = "SELECT a_username, a_password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM t_admin WHERE a_username='" & Replace(MM_valUsername,"'","''") &"' AND a_password='" & Replace(Request.Form("a_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_name") = MM_valUsername
If (MM_fldUserid <> "") Then
Session("mm_id") =
End If
If (MM_fldUserAuthorization <> "") Then
Session("mm_level") = (MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value) Else
Session("mm_level") = ""
End If
关键就是这里,Session("mm_id") = 要取得对应登录用户在access数据库中 t_admin表中a_id 的值 展开
<%
' *** 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("a_username"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="a_level"
MM_valUserid="a_id"
MM_redirectLoginSuccess="frame.asp"
MM_redirectLoginFailed="error.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_conn_bargain_STRING
MM_rsUser.Source = "SELECT a_username, a_password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM t_admin WHERE a_username='" & Replace(MM_valUsername,"'","''") &"' AND a_password='" & Replace(Request.Form("a_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_name") = MM_valUsername
If (MM_fldUserid <> "") Then
Session("mm_id") =
End If
If (MM_fldUserAuthorization <> "") Then
Session("mm_level") = (MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value) Else
Session("mm_level") = ""
End If
关键就是这里,Session("mm_id") = 要取得对应登录用户在access数据库中 t_admin表中a_id 的值 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询