you can not set cookies on pages that are basically just cflocations because
those pages are never loaded to the client browser.

"Paul Johnston" <[EMAIL PROTECTED]> wrote:
An email is sent out with a url on it.  THe url sets a cookie and then
redirects the user with a cflocation tag.

For some reason, the cflocation tag is run before the cfcookie tag is
complete thus not allowing the cookie to be set.

Any ideas?

Paul

PS Code:

<CFQUERY NAME="getnextpage" DATASOURCE="mydsn">
SELECT
        refid,
        formrefid,
        nextpage,
    campaignenddate
FROM
        qb_referral
WHERE
        refid='#URL.refid#'
</CFQUERY>


<CFIF getnextpage.RecordCount GT 0>
    <!--- set cookie (if it already exists it doesn't matter) --->
    <!--- set it to "CID<ID of campaign>" and equal to 1 --->
    <!--- we only need to check if it exists on the order pages --->
    <cfif getnextpage.campaignenddate eq "">
        <cfset enddate = Now()>
    <cfelse>
        <Cfset enddate = getnextpage.campaignenddate>
    </cfif>
    <cfset days_to_end = DateDiff("d",Now(),enddate)>
    <cfif days_to_end eq 0><Cfset days_to_end = 1></cfif>
    <!-- set cookie -->
    <cfcookie name="CID#getnextpage.refid#" value="1"
expires="#days_to_end#">
    <!-- check if cookie exists -->
    <cfif NOT IsDefined("cookie.CID#getnextpage.refid#")>
        <cflocation url="referralerror.cfm?refid=#URL.refid#">
    </cfif>
    <!--- <cfoutput>#Evaluate("cookie.CID" &
getnextpage.refid)#</cfoutput> --->
    <!-- set relevant things up -->
    <CFSET refid=getnextpage.refid>
    <CFSET formrefid=getnextpage.formrefid>
<CFELSE>
        <!-- ERROR: refid parameter not found -->
    <!--- if the cookie doesn't exist, send the refid in the URL --->
    <cflocation url="order.cfm">
</CFIF>

<CFIF getnextpage.RecordCount GT 0>
    <html><head>
    <meta http-equiv="Refresh"
content="0;url=http://www.blurgh.co.uk<cfoutput>#REReplace(CGI.SCRIPT_NAME,"
referral.cfm","","all")#</cfoutput>order.cfm">
    </head><body>
    <cfoutput>If this page doesn't redirect you <a
href="#getnextpage.nextpage#">click here</a></cfoutput>
    </body></html>
<!--- for some reason this needs to be here --->
    <cfabort>
    <cflocation url="#getnextpage.nextpage#">
</cfif>


------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.


____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message 
to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to