I created this based on coding that someone else had set up
in a tutorial. As I understand it, wouldn't my <cfinclude
template="include_CheckAuthority.cfm" statement have the page first
use the checkAutority.cfm page code first which verifies if the
user is logged in?
Here's the coding for that page along with its comments:
<!--- include_CheckAuthority.cfm --->
<!--- This file is used to check whether or not a user is
logged in, and can be included --->
<!--- in any page that needs to be "protected" from the
unauthorized user --->
<!--- Initialize our boolean flag to FALSE, saying the
user is not yet verified --->
<cfset bLoggedIn = False>
<!--- First, we check the session variable --->
<cfif IsDefined("Session.UserID")>
<cfif Session.UserID neq "">
<!--- if it is not false, we can assume that we have
stored the session.userid --->
<!--- so we set logged in to True - meaning the user is
verified --->
<cfset bLoggedIn = True>
</cfif>
<cfelse>
<!--- If there is NO session variable, that's OK, we can
check for a cookie that we set --->
<!--- to store the user id long term. --->
<cfif IsDefined("Cookie.UserID")>
<cfif Cookie.UserID neq "">
<!--- if there is a cookie, save it into the session
variable --->
<cfset Session.UserID = Cookie.UserID>
<!--- set logged in to True, because this user is
verified --->
<cfset bLoggedIn = True>
</cfif>
</cfif>
</cfif>
<!--- Check to make sure that the user was verified
--->
<cfif bLoggedIn eq False>
<!--- If not, then include an error file -basically
saying you are not authorized --->
<!--- to view this page, and then exit processing of the
template, so they don't see the rest --->
<cfinclude template="myErrorFile.cfm">
<cfexit>
</cfif>