A simple login, put this in your application.cfm or application.cfc page. At the top of each page set <cfif Session.LogInKeyword eq "George123"> Make up your own check pattern.
<cfapplication sessionmanagement="Yes" sessiontimeout="#createtimespan(0,0,15,0)#">
<cfparam name="LoggingOut" default="No">
<cfparam name="Session.LogInKeyword" default="none">
<cfparam name="Attempting" default="No">
<cfif LogginOut eq "Yes">
<cfset Session.LogInKeyword = "none">
<!--- This LoggingOut comes from any "Log Out" link or form --->
<cfif Session.LogInKeyword eq "none">
<cfif Attempting eq "Yes"> <!--- Sent "Yes" as hidden field from Login form --->
<cfquery name="GetLogIn" datasource="[Your DSN">
select UserPwd from Users where UserID = '#UserID#'
<cfif Form.UserPwd eq GetLogin.UserPwd>
<cfset Session.LogInKeyword eq "George123">
<h2>Sorry, Your Login is Incorrect</h2>
<h2>You Must Login<h2>
The PageHeader.htm would contain your DOCTYPE, HEAD, the LINK to your stylesheet, the BODY tag, and the banner, but NOT the navigation. That comes next:
<cfif Session.LogInKeyword eq "George">
... (Page content etc)
Okay, you caught me, I save my includes as .htm (I like the color coding in HTMLkit). But ColdFusion (unlike PHP) MERGES the include first, THEN parses the code. so you includes can contain CFML and be saved as .htm and they'll work fine.
~Bob in Texas
Last edited by TexasLegacy; 07-13-2010 at 08:54 PM..
Reason: Added the logout sequence