I apologize for the incomplete code before. Here is the code with the
form.remember stuff in it with some comments added in. The welcome
screen "index.cfm" is as follows:

<cfif IsDefined("cookie.LoggedIn")>
Welcome, your logged in as <cfoutput>#cookie.username# ID:
#cookie.ID#</cfoutput>
</cfif>
<cfif Not IsDefined("cookie.LoggedIn")>
Welcome, your logged in as <cfoutput>#session.Auth.username# ID
#session.Auth.ID#</cfoutput>
</cfif>

CHECKLOGIN.CFM

<!--- set session variables from cookie if they chose "remember me"
last time --->
<cfif IsDefined("cookie.LoggedIn")>
        <cfset session.Auth = StructNew()>
        <cfset Session.Auth.IsLoggedIn = "Yes">
        <cfset session.Auth.ID = cookie.id>
        <cfset session.Auth.username = cookie.username>
        <cflocation url="index.cfm" addtoken="No">
        <cfabort>
</cfif>

<!--- we're not auto-logging in, so let's authenticate --->
<cfparam name="form.UserLogin" type="string">
<cfparam name="form.Password" type="string">
<cfparam name="form.remember" default="Off" type="string">

<cfquery name="GetUser" datasource="#mydbname#">
        SELECT *
        FROM admin
        WHERE username = <cfqueryparam value="#Form.UserLogin#" />
        AND password =   <cfqueryparam value="#Form.password#" />
</cfquery>

<cfif GetUser.RecordCount EQ 1>
        <cfset session.Auth = StructNew()>
        <cfset Session.Auth.IsLoggedIn = "Yes">
        <cfset Session.Auth.ID = GetUser.ID>
        <cfset Session.Auth.UserName = GetUser.username>
        
        <cfif form.remember IS "On">
                <cfcookie name="LoggedIn" value="Yes" expires="NEVER">
                <cfcookie name="username" value="#GetUser.username#" 
expires="NEVER">
                <cfcookie name="ID" value="#GetUser.ID#" expires="NEVER">
        </cfif>
        
        <cfdump var="#session#"><cfabort>
        <cfoutput>
                <script 
language="javascript">location.replace('index.cfm');</script>
        </cfoutput>
        <cfabort>
<cfelse>





On Thu, Oct 2, 2008 at 11:45 AM, Tom Chiverton
<[EMAIL PROTECTED]> wrote:
> On Thursday 02 Oct 2008, Phillip Perry wrote:
>> with <cfif #form.remember# IS "on"></cfif>, that is when all goes down
>
> This doesn't appear in your example code.
>
>> Welcome, you are logged in as #session.Auth.username# ID: #session.Auth.ID#
>
> You are not creating these in your example code.
>
> And, as side notes: cfqueryparam all your queries. Be aware that a user can
> create their own cookies.
>
> --
> Tom Chiverton
> Helping to autoschediastically enable back-end interactive wireless
> leading-edge relationships
>
>
>
> ****************************************************
>
> This email is sent for and on behalf of Halliwells LLP.
>
> Halliwells LLP is a limited liability partnership registered in England and 
> Wales under registered number OC307980 whose registered office address is at 
> Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
> of members is available for inspection at the registered office. Any 
> reference to a partner in relation to Halliwells LLP means a member of 
> Halliwells LLP.  Regulated by The Solicitors Regulation Authority.
>
> CONFIDENTIALITY
>
> This email is intended only for the use of the addressee named above and may 
> be confidential or legally privileged.  If you are not the addressee you must 
> not read it and must not use any information contained in nor copy it nor 
> inform any person other than Halliwells LLP or the addressee of its existence 
> or contents.  If you have received this email in error please delete it and 
> notify Halliwells LLP IT Department on 0870 365 2500.
>
> For more information about Halliwells LLP visit www.halliwells.com.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313404
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to