%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' Names of roles users may log in as
Const AdvisorRoleName = "Advisor"
Const GuestRoleName = "Guest"
Const TeleconferenceRoleName = "Teleconference"
Const AdminRoleName = "Admin"
' Returns the user name of the current user.
Function GetCurrentUserName( _
)
GetCurrentUserName = Session( "MM_Username" )
End Function
' Returns the role name of the current user.
Function GetCurrentRoleName( _
)
GetCurrentRoleName = Session( "MM_RoleName" )
End Function
' Validates that the current user is logged in and in the correct role. If the user is not logged
' in or not in the correct role, he/she is redirected to a login page.
Sub AuthorizeCurrentUser( _
RoleName, _
LoginPage _
)
Dim MM_grantAccess
Dim MM_qsChar
Dim MM_referrer
' *** Restrict Access To Page: Grant or deny access to this page
MM_grantAccess=false
' If the user is logged in,
If GetCurrentUserName( ) <> "" Then
' and if the user is in the correct role for this page,
If GetCurrentRoleName( ) = RoleName Then
' The user is grnated access
MM_grantAccess = true
End If
End If
' If the user is not allowed to view this page,
If Not MM_grantAccess Then
' Redirect the user to the appropriate login page
MM_qsChar = "?"
If (InStr(1,LoginPage,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
LoginPage = LoginPage & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(LoginPage)
End If
End Sub
%>
<%
AuthorizeCurrentUser AdvisorRoleName, "advisoradvantage.htm"
Dim rsAdvisors1__MMColParam
rsAdvisors1__MMColParam = GetCurrentUserName( )
Dim rsAdvisors1
Dim rsAdvisors1_numRows
Set rsAdvisors1 = Server.CreateObject("ADODB.Recordset")
rsAdvisors1.ActiveConnection = Application("CenturionCounsel_ConnectionString")
rsAdvisors1.Source = "SELECT * FROM advisors WHERE username = '" + Replace(rsAdvisors1__MMColParam, "'", "''") + "'"
rsAdvisors1.CursorType = 0
rsAdvisors1.CursorLocation = 2
rsAdvisors1.LockType = 1
rsAdvisors1.Open()
rsAdvisors1_numRows = 0
%>