[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/26/2006 at 12:10PM PDT, ID: 22003525
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Critical: CF page inserting email newsletter signups multiple times

Asked by geraldw in ColdFusion Application Server

Tags: cfmail, cfcookie, cflocation, emails, newsletter

Hello,

We're running CFMX 6.1 on Win2003 Servers with Oracle 8.0.3 DB on UNIX. This is bad for me so I'm offering the maximum points.  

We have free projects available on our website in exchange for a consumer signing up for our email newsletter.  Somewhere along the way between say almost 2 years ago and just recently I made some kind of change that is allowing duplicate email names to be entered although the CFQUERY is supposed to check to see if the email_address is already in the database.  The weird thing is that I see the time of creation is so close together that it seems like the consumer couldn't have clicked the submit button that many times so quickly, for example:

EMAIL_NEWS_LIST_ID EMAIL_ADD            TO_CHAR(DATE
------------------ ---------------------------------------------  -----------
            150382 anonymous@yahoo.com      15:40:39 PM
            150383 anonymous@yahoo.com      15:40:40 PM
            150384 anonymous@yahoo.com      15:40:42 PM
            150385 anonymous@yahoo.com      15:40:41 PM
            150386 anonymous@yahoo.com      15:40:47 PM

When I just go to the page on my website and try to access the project by giving it my email address it does the right thing which is to check that I'm in the DB and since I am already there it does not add me again but just puts the cookie on my machine so that I can view the projects.

Here is my CF code.
<cfset date_created = CreateODBCDateTime(now())>

<!--- first check to see if the emailAdd from the form is in the DB --->
<cfif IsDefined("Form.emailAdd")>
      <cfset email_Add=Lcase(Form.emailAdd)>
            <cfquery datasource="#secondaryDS#" name="checkEmail">
                  select email_news_list_id, email_add
                  from            email_list
                  where            lower(email_add)=lower('#Form.emailAdd#')
            </cfquery>
</cfif>

<!--- if emailAdd is in DB set status to 1 and cflocate to page --->      
<cfif Form.emailAdd EQ checkEmail.email_add>
      <cfcookie name="inEmailList" value="Y" expires="never">
      <cflocation url="index.cfm?page=section/classroom/sewprojects/EraBonnet/eraBonnet.cfm">
<cfelse>
<!--- otherwise set emailStatus to 2 and add to DB, this will trigger proper message below --->
      <cfset emailStatus = 2>
      <cfset email_Add = "#Form.emailAdd#">
      <cftransaction>
            <cfquery name="addToEmailList" datasource="#secondaryDS#">
                  declare nk int;
                  
                  begin
                  
                  update next_key
                  set next_key = next_key + 1
                  where table_name = 'email_list';
                  
                  select next_key + 1 into nk
                  from next_key
                  where table_name = 'email_list';
                        
                  insert into email_list(
                        email_news_list_id,
                        email_add,
                        first_name,
                        last_name,
                        spanish_lang,
                        date_created,
                        promo_code
                  )
                  values(
                        nk,
                        '#Lcase(email_add)#',
                        '#first_name#',
                        '#last_name#',
                        '1',
                        #date_created#,
                        #promo_code#
                  );
                  end;
            </cfquery>
      </cftransaction>
      <cfcookie name="inEmailList" value="Y" expires="never">
      
      <!-- Run email reply -->
      <cfmail from="Newsletter@anonymous.com" to="#email_Add#" subject="Anonymous Co." server="#WEBMAIL_EMAIL_SERVER#">
Hello #email_Add#

Welcome to our newsletter.

      </cfmail>
      
<cflocation url="index.cfm?page=section/classroom/sewprojects/EraBonnet/eraBonnet.cfm" addtoken="no">
</cfif>
_______________________
Many thanks in advance,
Jerry
[+][-]09/26/06 12:32 PM, ID: 17604736

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/26/06 01:14 PM, ID: 17605158

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/26/06 01:17 PM, ID: 17605188

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/26/06 03:22 PM, ID: 17606068

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/27/06 08:28 AM, ID: 17611154

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/27/06 08:45 AM, ID: 17611290

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: ColdFusion Application Server
Tags: cfmail, cfcookie, cflocation, emails, newsletter
Sign Up Now!
Solution Provided By: shooksm
Participating Experts: 1
Solution Grade: B
 
 
[+][-]09/27/06 10:51 AM, ID: 17612363

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/27/06 11:01 AM, ID: 17821109

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74