1000kisoen
IS-IT--Management
Hi,
I have insert in de DEFAULT.ASP securitylevel
but when I tried to open a page where I entered the security level it just open the page even I am not authorized.
I'm busy for couple of hours but still not working.
could you please help me out with this.
her is my login page authentication
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("username"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="securitylevel"
MM_redirectLoginSuccess="Logintrack.asp"
MM_redirectLoginFailed="login.asp?error=1"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_tm_STRING
MM_rsUser.Source = "SELECT Supportlogin, Password, securitylevel"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM Support WHERE Supportlogin='" & Replace(MM_valUsername,"'","''") &"' AND 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("svUsername") = MM_valUsername
If (MM_fldUserAuthorization <> "FAM") 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
_____
and here is my code for the page where I just could open
<%
dim securitylevel
securitylevel = session("MM_UserAuthorization")
if securitylevel <>"admin" then
response.Redirect "noaccess.asp"
end if
%>
what is wrong with my code
'm I doning something wrong? or is my code just messy.
thx. Kisoen
I have insert in de DEFAULT.ASP securitylevel
but when I tried to open a page where I entered the security level it just open the page even I am not authorized.
I'm busy for couple of hours but still not working.
could you please help me out with this.
her is my login page authentication
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("username"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="securitylevel"
MM_redirectLoginSuccess="Logintrack.asp"
MM_redirectLoginFailed="login.asp?error=1"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_tm_STRING
MM_rsUser.Source = "SELECT Supportlogin, Password, securitylevel"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM Support WHERE Supportlogin='" & Replace(MM_valUsername,"'","''") &"' AND 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("svUsername") = MM_valUsername
If (MM_fldUserAuthorization <> "FAM") 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
_____
and here is my code for the page where I just could open
<%
dim securitylevel
securitylevel = session("MM_UserAuthorization")
if securitylevel <>"admin" then
response.Redirect "noaccess.asp"
end if
%>
what is wrong with my code
'm I doning something wrong? or is my code just messy.
thx. Kisoen