|
Hi,
I also don't like the way this code was written but it was written by me and now I have to work with it.
I am trying to call the ACCESS field after I have opened the record set but it doesn't work. Even if ACCESS=USER then I receive that Access =admin in the next page.
Here is the code of the first page. the recordset is in bold:
MM_LoginAction = Request.ServerVariables("URL") If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString MM_valUsername=CStr(Request.Form("Username")) If MM_valUsername <> "" Then MM_fldUserAuthorization="" MM_redirectLoginSuccess="myAds.asp" MM_redirectLoginFailed="myAds.asp" MM_flag="ADODB.Recordset" set MM_rsUser = Server.CreateObject(MM_flag) MM_rsUser.ActiveConnection = MM_connDUclassified_STRING MM_rsUser.Source = "SELECT U_ID, U_PASSWORD, ACCESS" If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization MM_rsUser.Source = MM_rsUser.Source & " FROM USERS WHERE U_ID='" & MM_valUsername &"' AND U_PASSWORD='" & CStr(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 DIM ACCESS access=(mm_rsuser.fields.item ("ACCESS").value)
DIM U_ID
DIM U_PWORD
'---create user cookie
if ACCESS<>"admin" then Response.Cookies("UserCookie")("Username") = Request.Form("UserName")
Response.Cookies ("UserCookie")("Password")=Request.Form ("Password")
Response.Cookies("UserCookie").Path = "/"
Response.Cookies ("UserCookie").expires =dateadd("h",1,now()) Response.Write(Request.Cookies("UserCookie")("Username")) Response.Write (Request.Cookies("UserCookie")("Password"))
'---end user cookie
else
'create admin cookie Response.Cookies("adminCOOKIE")("ADMINusername") = Request.Form("UserName")
Response.Cookies ("adminCOOKIE")("ADMINPassword")=Request.Form ("Password")
Response.Cookies("adminCOOKIE").Path = "/"
response.Cookies ("adminCOOKIE").expires =dateadd("h",1,now()) Response.Write(Request.Cookies("adminCOOKIE")("ADMINusername ")) Response.Write (Request.Cookies("adminCOOKIE")("ADMINPassword"))
'---end admin cookie
end if
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
|