% Option Explicit %> <% dim movie_email, retrieval_id, Question_Option_Answer2,Question_Option_Answer3 dim from_email, to_email1, to_email2, to_email3, to_email4, to_email5, message, arr_to_email, to_email dim sqlSelect, Conn, rs, sqlInsert, Lead_ID, sqlUpdate, sqlRetriever, eventcomments dim pagestep, errormessage errormessage = "" pagestep = 1 movie_email = nulltoblank(request.form("movie_email")) 'check for the email address in the URL dim movie_link movie_link=Request.QueryString("movie_email") If movie_link<>"" Then movie_email = movie_link End If Question_Option_Answer2 = request.form("Question_Option_Answer2") Question_Option_Answer3 = request.form("Question_Option_Answer3") eventcomments = NullToBlank(request.form("eventcomments")) sqlRetriever = NullToBlank(request.querystring("retrieval_id")) 'we check if movie_email was set and then update the database if (movie_email <> "") then // sqlSelect = "SELECT lead_ID FROM Lead WHERE Email_Address = '"& movie_email &"'" // set rs = conn.execute(sqlSelect) // if rs.eof then // errormessage = "notfound" // else sqlInsert = "EXEC hyundai_movie_checkview '"& movie_email &"', '"& escape(eventcomments) &"'" Conn.Execute(sqlInsert) sqlSelect = "SELECT top 1 Lead_Answer_ID as response FROM lead_answer la INNER JOIN Lead l ON l.Lead_ID = la.Lead_ID WHERE l.Email_address = '"& movie_email &"' AND (Question_ID = 2 OR Question_ID = 3)" set rs = Conn.execute(sqlSelect) if not rs.eof then pagestep = 3 sqlInsert = "EXEC hyundai_add_video_view '"& movie_email &"'" Conn.execute(sqlInsert) else pagestep = 2 if (Question_Option_Answer2 <> "" and Question_Option_Answer3 <> "") then Conn.execute("EXEC hyundai_add_questionanswers '"& movie_email & "', "& Question_Option_Answer2&", '"& Question_Option_Answer3 &"'") pagestep = 3 end if end if // end if end if from_email = NullToBlank(request.form("from_email")) to_email1 = NullToBlank(request.form("to_email1")) to_email2 = NullToBlank(request.form("to_email2")) to_email3 = NullToBlank(request.form("to_email3")) to_email4 = NullToBlank(request.form("to_email4")) to_email5 = NullToBlank(request.form("to_email5")) message = NullToBlank(request.form("message")) arr_to_email = Array(to_email1, to_email2, to_email3, to_email4, to_email5) for each to_email in arr_to_email if ( to_email <> "" AND from_email <> "") then retrieval_id = Retriever() 'response.write("EXEC hyundai_add_sent_email '"& from_email &"','"& to_email &"','"& retrieval_id &"'" ) sqlInsert = "EXEC hyundai_add_sent_email '"& from_email &"','"& to_email &"','"& retrieval_id&"'" conn.execute(sqlInsert) Dim oMail Set oMail = Server.CreateObject("CDO.Message") oMail.From = from_email oMail.to = to_email oMail.Subject = "You've been sent a Hyundai Challenge video from " & from_email oMail.TextBody = "Message from "& from_email &":" &_ vbcrlf &_ vbcrlf &_ message &_ vbcrlf &_ vbcrlf &_ "Hey, I just drove a new Hyundai at the ""California Hyundai Challenge"" There were some crazy moments, but my Hyundai and I made it through just fine."&_ vbcrlf &_ vbcrlf &_ "The ""California Hyundai Challenge"" is a unique, hands-on driving experience that is appearing throughout our great state. You'll see everything that California has to offer...its landmarks...unique people...and, of course, the hottest Hyundai vehicles to ever hit the freeway." &_ vbcrlf &_ vbcrlf &_ "Maybe you can catch up with the ""Challenge"" and get a chance to really ""Drive Your Way,"" too." &_ vbcrlf &_ vbcrlf &_ "Website: http://"& request.servervariables("HTTP_HOST") &"/movie.asp?movie_email=" & request.form("from_email") &_ vbcrlf &_ vbcrlf &_ "You have been forwarded this email from a friend and are not currently subscribed to receive e-mails from Hyundai in the future."&_ vbcrlf &_ "For more information about Hyundai in general, go to http://www.hyundaiusa.com" oMail.Send set oMail = nothing end if next 'now we check to see if this user received a link via email if sqlRetriever <> "" then sqlUpdate = "UPDATE hyundai_email_friend SET receiving_timestamp = GETDATE() WHERE retrieval_id = '"& sqlRetriever &"'" Conn.execute(sqlUpdate) sqlSelect = "SELECT senders_email FROM hyundai_email_friend WHERE retrieval_id = '"& sqlRetriever &"'" 'response.write sqlSelect set rs = Conn.execute(sqlSelect) if not rs.eof then movie_email = rs("senders_email") 'response.write movie_email pagestep = 3 end if rs.close set rs = nothing end if Conn.close set Conn = nothing %>