You can't use cflocation in the same template as cfcookie.  Try using 
javascript to redirect your user instead.

>Hi,
>
>I'm trying to make a simple cookie for testing  but its not working
>out. I use it for log in verification. The problem is the cookie gets
>stored but the redirect is not happening. I use the  code below. The
>second redirect is the problem. Instead of going to newindex.cfm its
>loading the loginform.cfm file. Any ideas what i'm doing wrong?:
>
><cfquery name="GetUser" Datasource="#datasource#" password="#pw#">
>SELECT *
>FROM admin
>WHERE username = '#Form.UserLogin#'
>      AND password =   '#Form.password#'
></cfquery>
><cfif IsDefined("cookie.Confirmed") EQ "Yes">
><cfset session.Admin = StructNew()>
><cfset Session.Admin.Confirmed = "Yes">
> <cfheader name="location" value="index.cfm">
><cfheader statusCode="302" statusText="Document Moved">
><cfabort>
></cfif>
><cfparam name="form.UserLogin" type="string">
><cfparam name="form.Password" type="string">
><cfif GetUser.RecordCount EQ 1>
><cfset session.Admin = StructNew()>
><cfset Session.Admin.Confirmed = "Yes">
><cfset Session.Admin.ContactID = GetUser.ID>
><cfset Session.Admin.UserName = GetUser.username>
><CFCOOKIE NAME="Check_Login" VALUE="Yes" EXPIRES="NEVER">
><cfheader name="location" value="newindex.cfm">
><cfheader statusCode="302" statusText="Document Moved">
><cfabort>
>
><cfelse>
><cfset message="We apologize but that username / password does not
>match our records. Please try again.">
><cflocation url="#cgi.script_name#?message=#message#" ADDTOKEN="No">
></cfif> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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-newbie/message.cfm/messageid:4027
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to