%@ LANGUAGE = "VBScript" %>
<%
'-----------------------------------------------------------
' ASPilot.com - Newsletter
' ------------------------------
' Copyright © 2004 Spliethof Inc
'
' This file lists all the newsletter interface for the
' shopping cart.
PilotInitialize
GetCurrentCustomer
MarkCurrentCustomerActive
mode = EStr(Request.QueryString("mode"))
sorry = "
Sorry, nothing was found.
| Tip: If browsing is not yielding the results you are looking for, why not try using our search engine? |
"
If Not PilotPageBegin("newsletter", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp"
B2BCheckLogin "newsletter"
Select Case mode
Case "subscribe"
myEmail = Request.Form("myEmail")
If myEmail <> "" And ValidEmailAddress(myEmail) = True Then
strSQL = "SELECT MY_EMAIL FROM TBLNEWSLETTER WHERE MY_EMAIL='"&myEmail&"'"
Set rsU = cnPILOT.Execute(strSQL)
If rsU.EOF Then
strSQL = "INSERT INTO TBLNEWSLETTER(MY_EMAIL, THE_DATE, MAILERID) VALUES('"&myEmail&"', '"&Now()&"', '0')"
Set rsNL = cnPILOT.Execute(strSQL)
Set rsNL = Nothing
End If
rsU.Close : Set rsU = Nothing
Response.Redirect"newsletter.asp?mode=subscribed"
Else Response.Redirect"newsletter.asp?mode=error"
End If
Case "subscribed"
Response.Write g.Str("NewsletterSubscribed")
Case "error"
Response.Write g.Str("NewsletterError")
Case "unsubscribed", "un"
email = Request.QueryString("email")
If Trim(email&"X") = "X" Then email = Request.QueryString("e")
If email <> "" Then
Set rs = cnPILOT.Execute("SELECT * FROM TBLNEWSLETTER WHERE MY_EMAIL = '"&email&"';")
If Not rs.EOF Then
strSQL = "DELETE * FROM TBLNEWSLETTER WHERE MY_EMAIL = '"&email&"';"
Response.Write strSQL
cnPILOT.Execute(strSQL)
Response.Write g.Str("NewsletterUnsubscribed")
Else Response.Write sorry
End If
Else Response.Write sorry
End If
Case Else
Response.Write img1 & pc
End Select
TemplateAfterPC
PilotPageEnd
%>