CF_Customlogin uses cookies here is the application file.

Are these not client side vars?

Jim Louis
<!---////////// Enable Session Management //////////--->
<cfApplication name="CF_CustomLogin"
sessionManagement="yes"
sessionTimeout="#createTimeSpan(0,0,15,0)#"
applicationTimeout="#createTimeSpan(0,1,0,0)#">

<!---////////// CustomLogin Tag //////////--->
<CF_CustomLogin
DB="cf_customlogin"
DBTable="users"
DBUserNameField="username"
DBPasswordField="password"
PageBackColor="##000000"
FormBackColor="##000000"
FormBorderColor="##ffcd00"
FormLogo="http://demo.wahmann.com/cf_customlogin/cat.jpg"
ContactEmail="[EMAIL PROTECTED]"
>

<!---////////// Kill Sessions On Exit //////////--->
<cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
<cfset cfid_local = Cookie.CFID>
<cfset cftoken_local = Cookie.CFTOKEN>
<cfcookie name="CFID" value="#cfid_local#">
<cfcookie name="CFTOKEN" value="#cftoken_local#">
</cfif>

Here is the Login screen code

<!---////////// Set the locks //////////--->
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfparam name="session.LoggedIn" default="">
</cflock>
<cflock scope="SESSION" timeout="20" type="READONLY">
<cfset variables.LocalLoggedIn = Duplicate(session.LoggedIn)>
</cflock>

<!---////////// Begin User Login //////////--->
<cfif #variables.LocalLoggedIn# IS "FALSE" OR #variables.LocalLoggedIn# IS "">

<!---////////// Error checking ///////////--->
<cfif IsDefined("attributes.DB") OR IsDefined("attributes.DBTable") OR IsDefined("attributes.DBUserNameField") OR IsDefined("attributes.DBPasswordField")>
<cfif IsDefined("attributes.StaticUserName") OR IsDefined("attributes.StaticPassword")>
<div align="center"><font size="2" color="#FF0000">You can't pass DATABASE attributes and STATIC UserName/Password attributes.</font></div>
<cfabort>
</cfif>
</cfif>
<cfif NOT IsDefined("attributes.DB") OR NOT IsDefined("attributes.DBTable") OR NOT IsDefined("attributes.DBUserNameField") OR NOT IsDefined("attributes.DBPasswordField")>
<cfif NOT IsDefined("attributes.StaticUserName") OR NOT IsDefined("attributes.StaticPassword")>
<div align="center"><font size="2" color="#FF0000">You must pass ALL DATABASE attributes or STATIC UserName/Password attributes.</font></div>
<cfabort>
</cfif>
</cfif>

<!---////////// Set default parameters //////////--->
<cfparam name="PageBackColor" default="##ffffff">
<cfparam name="FormBackColor" default="##eeeeee">
<cfparam name="FormBorderColor" default="##000000">
<cflock scope="SERVER" timeout="15" type="EXCLUSIVE">
<cfparam name="returnPath" default="http://#cgi.SERVER_NAME##cgi.PATH_INFO#">
</cflock>

<!---////////// Set tag attributes //////////--->
<cfif IsDefined("attributes.DB")>
<cfset DB="#attributes.DB#">
</cfif>
<cfif IsDefined("attributes.DBTable")>
<cfset DBTable="#attributes.DBTable#">
</cfif>
<cfif IsDefined("attributes.DBUserNameField")>
<cfset DBUserNameField="#attributes.DBUserNameField#">
</cfif>
<cfif IsDefined("attributes.DBPasswordField")>
<cfset DBPasswordField="#attributes.DBPasswordField#">
</cfif>
<cfif IsDefined("attributes.StaticUserName")>
<cfset StaticUserName="#attributes.StaticUserName#">
</cfif>
<cfif IsDefined("attributes.StaticPassword")>
<cfset StaticPassword="#attributes.StaticPassword#">
</cfif>
<cfif IsDefined("attributes.PageBackColor")>
<cfset PageBackColor="#attributes.PageBackColor#">
</cfif>
<cfif IsDefined("attributes.FormBackColor")>
<cfset FormBackColor="#attributes.FormBackColor#">
</cfif>
<cfif IsDefined("attributes.FormBorderColor")>
<cfset FormBorderColor="#attributes.FormBorderColor#">
</cfif>
<cfif IsDefined("attributes.FormLogo")>
<cfset FormLogo="#attributes.FormLogo#">
</cfif>
<cfif IsDefined("attributes.ContactEmail")>
<cfset ContactEmail="#attributes.ContactEmail#">
</cfif>
<cfif IsDefined("attributes.returnPath")>
<cfset returnPath="#attributes.returnPath#">
</cfif>

<!---////////// Check if DB is defined //////////--->
<cfif IsDefined("DB") AND IsDefined("DBTable") AND IsDefined("DBUserNameField") AND IsDefined("DBPasswordField")>
<cfif IsDefined("form.UserName") AND IsDefined("form.Password")>
<cfquery name="CheckUser" datasource="#DB#">
SELECT #DBUserNameField#, #DBPasswordField#
FROM #DBTable#
WHERE #DBUserNameField# = '#form.username#'
</cfquery>
<!--////////// Is the username present in the database? //////////-->
<cfif #CheckUser.RecordCount# GT 0>
<!---////////// Do the passwords match? //////////--->
<cfif #CheckUser.Password# IS #form.Password#>
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfset #session.LoggedIn# = TRUE>
</cflock>
<cflocation url="" "HHmmss"))#" addtoken="no">
<cfelse>
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfset #session.LoggedIn# = FALSE>
</cflock>
<cfset reason = "Invalid Password!">
</cfif>
<cfelse>
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfset #session.LoggedIn# = FALSE>
</cflock>
<cfset reason = "Invalid User Name!">
</cfif>
</cfif>
<!---////////// Check if username and password are defined //////////--->
<cfelseif IsDefined("StaticUserName") AND IsDefined("StaticPassword")>
<cfif IsDefined("form.UserName") AND IsDefined("form.Password")>
<!---////////// Do the usernames match? //////////--->
<cfif #StaticUserName# IS #form.UserName#>
<!---////////// Do the passwords match? //////////--->
<cfif #StaticPassword# IS #form.Password#>
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfset #session.LoggedIn# = TRUE>
</cflock>
<cflocation url="" "HHmmss"))#" addtoken="no">
<cfelse>
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfset #session.LoggedIn# = FALSE>
</cflock>
<cfset reason = "Invalid Password!">
</cfif>
<cfelse>
<cflock scope="SESSION" timeout="20" type="EXCLUSIVE">
<cfset #session.LoggedIn# = FALSE>
</cflock>
<cfset reason = "Invalid User Name!">
</cfif>
</cfif>
</cfif>

<!---////////// Display the form if not logged in //////////--->
<cfif #variables.LocalLoggedIn# IS FALSE OR #variables.LocalLoggedIn# IS "">
<cfoutput>
<html>
<head>
    <title><cflock scope="SERVER" timeout="15" type="READONLY">http://#cgi.SERVER_NAME#</cflock></title>
</head>
    <body bgcolor="#PageBackColor#" link="#PageBackColor#" vlink="#PageBackColor#" >     <table width="100%" height="100%">
    <tr>
    <td valign="middle">
    <table align="center" bgcolor="#FormBorderColor#" border="0" cellpadding="2" cellspacing="0" width="300">
    <tr>
    <td align="center" width="100%">
    <table align="center" bgcolor="#FormBackColor#" border="0" cellpadding="0" cellspacing="0" height="100" width="100%">
    <tr>
    <td align="center" valign="middle" height="50">
<cfif IsDefined("FormLogo") AND #FormLogo# IS NOT "">
<img src=""> <cfelse>
<font color="#FormBorderColor#" face="verdana,tahoma,arial" size="2">
<strong><cflock scope="SERVER" timeout="15" type="READONLY">http://#cgi.SERVER_NAME#</cflock></strong>
</font>
</cfif>
</td>
    </tr>
<!---////////// Display error message //////////--->
    <cfif IsDefined("reason")>
<tr>
    <td align="center">
<font color="#FormBorderColor#" face="verdana,tahoma,arial" size="2"><strong>#reason#</strong></font>
</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
</cfif>
    <cfform action="" "HHmmss"))#" method="post" name="login">
<tr>
    <td>
    <table align="center" border="0" cellpadding="1" cellspacing="1">
    <tr>
    <td align="right"><strong><font color="#FormBorderColor#" face="verdana,tahoma,arial" size="2">User Name:</font></strong>&nbsp;</td>
    <td><cfinput type="text" name="username" size="15" maxlength="50" required="yes" message="User Name Required!"></td>
    </tr>
    <tr>
    <td align="right"><strong><font color="#FormBorderColor#" face="verdana,tahoma,arial" size="2">Password:</font></strong>&nbsp;</td>
    <td><cfinput type="password" name="password" size="15" maxlength="50" required="yes" message="Password Required!"></td>
    </tr>
    <tr>
    <td align="center" colspan="2" height="55"><input type="submit" value=" Login " class="stdBody"></td>
    </tr>
    </table>
    </td>
    </tr>
</cfform>
    </table>
    </td>
    </tr>
    <tr>
    <td align="center" valign="middle">
<cfif IsDefined("ContactEmail") AND #ContactEmail# IS NOT "">
<font color="#PageBackColor#" face="verdana,tahoma,arial" size="2">Questions:</font>
<a href="" face="verdana,tahoma,arial" size="2">#ContactEmail#</font></a>
    <cfelse>
&nbsp;
</cfif>
</td>
   </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
</html>
</cfoutput>
</cfif>

<cfabort>
</cfif>



>Yes...use client side vars to track customers...cookies work great ;-)
>
>Bryan Stevenson B.Comm.
>VP & Director of E-Commerce Development
>Electric Edge Systems Group Inc.
>phone: 250.480.0642
>fax: 250.480.1264
>cell: 250.920.8830
>e-mail: [EMAIL PROTECTED]
>web: www.electricedgesystems.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to