Helpful Information
 
 
Category: ASP
Confirm Subscription

Ok, the base of my code is Ocean12 ASP Mailing List Manager (http://scripts.ocean12tech.com/). The free version of the script has it's limitations, so I'm attempting add a feature here & there on my own.

As it stands, when you sign up for the Newsletter, it adds your e-mail to the database and that's it. The next step is I send a mailing to the list and get bounced e-mails for the people that say their e-mail address has a coma in it or that don't give me the "@yahoo.com" portion of their address.

Rather than get 5-10 bounced e-mails at once, I'd rather 'weed them out' as I go. And provide a security feature into the script. The database table looks like this at Download:

ID | EMail | First Name | Last Name | Date Joined

I've added a sixth column to the table, "Conf" which is a Yes/No field. Either it's "true" or it's "false". I should mentioned, I'm running off of Access. By default, when a user signs up, the Conf field is set to 'False'. For all intents and purposes, this means they haven't "Confirmed" their subscription yet.

At this point, and e-mail is sent to the directing them to a particular URL which will 'confirm' their subscription. I've skipped the automated e-mail for now, because I'm working on the page it directs them to first.

This is where my problem comes in. To keep the the confirmation process somewhat secure, I'm directing them to "[email protected]" for instance, without the () of course.

However, it's returning Syntax error (missing operator) in query expression 'Email = [email protected]' (http://www.mickeysguidingstuff.net/newsletter2/[email protected]). The code I'm using follows:


********Included Page, Cannot Edit Start********
<%
dim dsn
dim Conn
dsn="DBQ=" & Server.Mappath("/fpdb/o12mail.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open dsn
%>
********Included Page, Cannot Edit End**********

<%
Dim strSql, infoRS

Email = Request.QueryString("Email")
%>

<%
IF Len(Email) > 0 THEN
GetImage()
DisplayGood()
ELSE
DisplayBad()
END IF

%>

<% Sub GetImage()
strSql = "SELECT * FROM List WHERE Email = " & Email & ";"
set infoRS = Conn.Execute(strSql)
End Sub %>

<% Sub DisplayGood() %>

<html>

<head>
</head>

<body>

<%= infoRS("Email") %><br><%= infoRS("Name_First") %><br><%= infoRS("Conf") %>
</body>

</html>
<!--#include file="dsn2.asp"-->

<% End Sub %>

<% Sub DisplayBad() %>
<html>

<head>
</head>

<body>
This is a Bad Display
</body>

</html>
<!--#include file="dsn2.asp"-->
<% End Sub %>

Can I have an e-mail address in the URL like that? It's picking out "line 21" on the error, which is this line "set infoRS = Conn.Execute(strSql)". Any ideas?

Any help is much appreciated! :-)

Thanks!

Jer!

Try this instead:

strSql = "SELECT * FROM List WHERE Email = '" & Email & "' "

*speaking in a very monotone voice while glancing occassionally at the palm of my hand to read a small piece of paper...*

Thank...You...Very...Much...Whammy.
This...Solved...My...Problem...Precisely.
You...Should...Be...Nominated...For...Some...Super... Duper...Wonderful...Moderator...Award...Or...Something.
You...Are...The...Man.

Seriously, m8, thanks a bunch! :-)

That did the trick! :-)

Jer!

Dang, I have to give better prompts! ;)










privacy (GDPR)