Home
Coffee
Tea
Menu & Catering
Community
Music & Arts
Subscribe
<%@LANGUAGE="VBSCRIPT"%>
Signup for our newsletter
Enter email address and press
Subscribe
to signup for the periodic newsletter or
Unsubscribe
to drop your email from the mailing. Use
Cancel
to clear the email address.
Email Address:
<% rem Dim oConn, oRs Dim qry, connectstr rem Dim db_name, db_username, db_userpassword rem Dim db_server Dim uniid Dim subscribe_option Dim validCaptcha Dim errCount rem response.write("Email address:" & request.Form("email_address") & ".
") rem response.write("Subscribe : " & request.Form("subscribe") & ".
") rem response.write("Subscribe : " & request.Form("subscribe") & ".
") rem response.write("Captcha : " & request.Form("captchacode") & ".
") ' Set the mail server configuration Set objConfig=CreateObject("CDO.Configuration") objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net" objConfig.Fields.Update ' Create and send the mail Set objMail=CreateObject("CDO.Message") Set objMail.Configuration=objConfig objMail.From="info@coffeemuggers.com" objMail.To="info@coffeemuggers.com" objMail.Subject="Subscription update" subscribe_option = request.Form("subscribe") if not IsEmpty(Request.Form("subscribe")) Then rem response.write("First if...
") rem validCaptcha = TestCaptcha("MAGICCAPTCHA", Request.Form("captchacode")) rem If TestCaptcha("MAGICCAPTCHA", Request.Form("captchacode")) Then rem response.write("Second if...
") fieldname = "email" tablename = "users" oConn.Open db_connection rem State is returned as 1 when successful, 0 otherwise rem response.write (oConn.State) qry = "SELECT * FROM " & tablename If subscribe_option = "Subscribe" Then Dim html_option If request.Form("htmlemail") = "nohtml" Then html_option = "0" Else html_option = "1" End If sql = "INSERT INTO users (`email`) VALUES ('" & request.Form("email_address") & "')" rem sql = "INSERT INTO users (`email`,`htmlemail`) VALUES ('" & request.Form("email_address") & "','" & html_option & "')" rem sql = "INSERT INTO " & tablename & " (`email`, `entered`) VALUES ('" & request.Form("email_address") & "', " & date() & ")" Else sql = "DELETE FROM " & tablename & " WHERE " & fieldname & "='" & request.Form("email_address") & "'" End If rem response.write("
Attempting SQL operation of:
" & sql & " into " & tablename & ".
") On Error Resume Next oConn.Execute sql,recaffected If recaffected = 0 Then If subscribe_option = "Subscribe" Then response.write("
Email address already exists for " & request.Form("email_address") & ".
") Else response.write("
Email address does not exist for " & request.Form("email_address") & ".
") End If Else If recaffected = 1 Then response.write("
Email address of " & request.Form("email_address") & " has been " & subscribe_option & "d.
") objMail.HTMLBody = "Email address for " & request.Form("email_address") & " was " & subscribe_option & "d." objMail.Send Set objMail = Nothing Else response.write("
Internal error encountered.
") End If End if oConn.Close set rs = nothing Set oConn = Nothing rem Else rem response.write("
Invalid code entered. Please try again.
") rem End if End If %>