<% 'REQUEST COOKIE VALUES '------------------------------------------------------------------- Dim UserId UserId = Request.Cookies("user")("id") 'If UserId = "" Then Response.Redirect("../includes/inc_accessdenied.asp") 'LOG-OUT USER '------------------------------------------------------------------- If Request("Logout") = "true" Then Response.Cookies("user") = "" 'PATH, PAGE & FOLDER TRACKER '------------------------------------------------------------------- Dim URLpath URLpath = Split(Request.ServerVariables("SCRIPT_NAME"), "/") 'Current Root Path Dim URLpage, URLfolder, URLmodule URLpage = URLpath(Ubound(URLpath)) 'Current Page URLfolder = URLpath(Ubound(URLpath) - 1) 'Current Folder 'URLmodule = Left(URLpage, Instr(URLpage, "_") - 1) 'Module Dim PageRights PageRights = Replace(URLpage, ".asp", "") PageRights = Right(PageRights, Len(PageRights) - InstrRev(PageRights, "_")) 'MAIN NAVIGATION AND PAGE RIGHTS '------------------------------------------------------------------- SQL = "SELECT * FROM vw_accessrights WHERE AdminUserId = '" & UserId & "'" On Error Resume Next Err.Clear Set rs = rsReadOnly(conn, SQL, True) 'Trap and display Errors If Err.number <> 0 Then Response.Write "

An error occurred while building the Menu Structure.

" & vbcrlf Response.Write GetSQLErrors(conn) blnError = True Set rs = Nothing Response.End End If Dim MainNavigation, iCounter MainNavigation = "" iCounter = 0 'Loop through all records Do While Not rs.EOF 'Menu Construction 'oCMenu.makeMenu('top0','','Home','../home/index.asp') iCounter = iCounter + 1 MainNavigation = MainNavigation & "oCMenu.makeMenu('" & iCounter & "','','" & rs("Section") & "','" & rs("URL") & "')" & vbCrlf 'Check Section Rights If lCase(rs("Folder")) = URLfolder Then Dim ViewRights, AddRights, EditRights, DeleteRights ViewRights = rs("ViewOnly") AddRights = rs("AddNew") EditRights = rs("Edit") DeleteRights = rs("Remove") End If rs.MoveNext Loop 'Log-Out MainNavigation = MainNavigation & "oCMenu.makeMenu('top0','','Log-Out','index.asp?logout=true')" 'Close Recordset Set rs = Nothing blnError = False 'SUB NAVIGATION - Function '------------------------------------------------------------------- Function SubNav(Name, URL) If URLpage = URL Then Response.Write "" Response.Write "" & Name & "" Response.Write "" Else Response.Write "" Response.Write "" & Name & "" Response.Write "" End If End Function 'CHECK USERS ACCESS RIGHTS TO THE PAGE '------------------------------------------------------------------- Dim UserAccess Select Case PageRights Case "view" UserAccess = ViewRights Case "add" UserAccess = AddRights Case "edit" UserAccess = EditRights Case "delete" UserAccess = DeleteRights Case Else 'Response.Redirect("accessdenied.asp") End Select 'Redirect if user doesn't have page rights 'If UserAccess = False Then Response.Redirect("../includes/inc_accessdenied.asp") '------------------------------------------------------------------- 'REMOVE THIS - USED FOR TESTING PURPOSES '------------------------------------------------------------------- 'Response.Write "UserId: " & Request.Cookies("user")("id") & "
" 'Response.Write "Page: " & URLpage & "
" 'Response.Write "Folder: " & URLfolder & "
" 'Response.Write "Module: " & URLmodule & "
" 'Response.Write "PageRights: " & PageRights & "
" 'Response.Write "UserAccess: " & UserAccess & "
" 'Response.Write "Main Navigation: " & MainNavigation & "
" 'Response.Write "View: " & ViewRights & "
" 'Response.Write "Add: " & AddRights & "
" 'Response.Write "Edit: " & EditRights & "
" 'Response.Write "Delete: " & DeleteRights & "
" %>