Listing 1

<form action="loginip.cfm" method="post">
 Username: <input type="Text" name="Username"> <br>
 Password: <input type="Text" name="Password"> <Br>
 <input type="Checkbox" name="RememberMe" value="True"> Remember Me<br>
 <input type="Submit">
</form>

Listing 2

<!---- Get User's info based on db ------>
<cfquery name="GetUser" datasource="CFDJCF101August">
 select users.*, SecurityUserGroups.GroupID
 from users, SecurityUserGroups
 where users.UserID = SecurityUserGroups.userID and
  users.username = '#form.username#' and
  users.password = '#form.password#'
</cfquery>

<!---- If the recordcount is 0, the login info is invalid  --->
<cfif GetUser.recordcount GTE 1>
 <cfset session.loggedin = true>
 <cfset session.Groups = ValueList(getUser.GroupID)>

 <!--- set the RememberMe cookie ----->
 <cfif form.RememberMe is true>
  <cfcookie name="UserID" value="#GetUser.UserID#" expires="never" >
 </cfif>

<cfelse>

 You didn't log in<br>
</cfif>

Listing 3

<cfif not IsDefined("session.loggedin")>
 <cfif IsDefined("cookie.UserID")>
  <!---- Get User's info based on db ------>
  <cfquery name="GetUser" datasource="CFDJCF101August">
   select users.*, SecurityUserGroups.GroupID
   from users, SecurityUserGroups
   where users.UserID = SecurityUserGroups.userID and
   users.userID = #Cookie.UserID#
  </cfquery>

  <!---- If the recordcount is 0, the login info is invalid --->
  <cfif GetUser.recordcount GTE 1>
   <cfset session.loggedin = true>
   <cfset session.Groups = ValueList(getUser.GroupID)>
   <cfdump var="#session#">
 <cfelse>
   <cfset session.loggedin = false>
   <cfset session.Groups = "2">
  </cfif>
 <cfelse>
  <cfset session.loggedin = false>
  <cfset session.Groups = "2">
 </cfif>
</cfif>