adam1h
asked on
Coldfusion Newsletter's Token Bug
Hi,
I have the following code into my Application.cfc file ; into the 'onRequest' function, for testing purposes.
Normally I'll put it into 'onSessionStart' function.
The bug is the code seems to execute well, but without any reason, the server modify the browser's url, adding tokens to it. So I have the message "page cannot be found".
The url should be:
https://www.joe-cool.co.uk/EN/home/home.cfm
but it is replaced by:
https://www.joe-cool.co.uk/EN/home/www.joe-cool.co.uk?CFID=5071941&CFTOKEN=73411406
Please help, I'm pulling my hair ! Thanks.
PS: the page "myJoeCool" that I include & put into the variable "mailContent" is a page listing customers's preious orders.
I have the following code into my Application.cfc file ; into the 'onRequest' function, for testing purposes.
Normally I'll put it into 'onSessionStart' function.
The bug is the code seems to execute well, but without any reason, the server modify the browser's url, adding tokens to it. So I have the message "page cannot be found".
The url should be:
https://www.joe-cool.co.uk/EN/home/home.cfm
but it is replaced by:
https://www.joe-cool.co.uk/EN/home/www.joe-cool.co.uk?CFID=5071941&CFTOKEN=73411406
Please help, I'm pulling my hair ! Thanks.
PS: the page "myJoeCool" that I include & put into the variable "mailContent" is a page listing customers's preious orders.
<cfset Session.Newsletter = "no">
<cfif session.email EQ "vincent@joe-cool.co.uk">
<cfquery name="emailsToAdd" datasource="joecool_web">
select distinct email from webAccounts where buyerCategory not like 'consumer' && buyerCategory not like '%shop' && email like '%@%.%' && email not in (select distinct email from webAccountsNews)
</cfquery>
<cfset todaysDate = DateFormat("#Now()#","yy/mm/dd")>
<cfset refDate = DateFormat(DateAdd("d", -22, Now()), "yy/mm/dd")>
<cfloop query="emailsToAdd">
<cfquery name="insert" datasource="joecool_web">
insert into webAccountsNews (email, newsDate) values (<cfoutput>'#emailsToAdd.email#', '#refDate#'</cfoutput>)
</cfquery>
</cfloop>
<cfquery name="emails" datasource="joecool_web">
select email, newsDate from webAccountsNews
</cfquery>
<cfloop query="emails">
<cfset y = left("#emails.newsDate#", 2)>
<cfset m = mid("#emails.newsDate#", 4, 2)>
<cfset d = right("#emails.newsDate#", 2)>
<cfset thisNewsDate = CreateDate(#y#, #m#, #d#)><cfdump var="#thisNewsDate#"> <cfdump var="#refDate#">
<cfif thisNewsDate LTE refDate>trouloulou<br />
<cfset Session.Newsletter = "yes">
<cfset url.email = "vincent@joe-cool.co.uk">
<!---<cfsavecontent variable="mailContent"><cfinclude template="./EN/mydetails/myjoecool.cfm"></cfsavecontent>--->
<!---<cfmail to="webstaff@joe-cool.co.uk" FROM="#Session.emailFrom#" subject="Test News Auto" type="html" server="#Session.emailServer#">
<cfoutput>#mailContent#</cfoutput>
</cfmail>--->
<cfset Session.Newsletter = "no">
</cfif>
</cfloop>
</cfif>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot, very helpful
ASKER
I haven't change it & it always works fine ; but it can helps
Open in new window