% 'Newsletter Manager Pro v.6.51 'Copyright 2006 DesignerFreeSolutions 'http://www.designerfreesolutions.com 'TIP: FIND YOUR COUNTRY'S LCID HERE: 'http://www.drdev.net/LocaleIDs.asp 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsmsclcid.asp 'Europe dd/mm/yy: 1036 'US mm/dd/yy: 1033 'AND ACTIVATE THE LINE BELOW 'Session.LCID = "1033" %>
|
|
|
|
|
The Bookclub-in-a-Box Newsletter Management Centre <% on error resume next dim mySQL, connTemp, rsTemp myDay = makeMyDayTime(FormatDateTime(date, 2)) 'response.write myDay 'response.end pcustomsubfield1js = replace(pcustomsubfield1,chr(32),"") pcustomsubfield2js = replace(pcustomsubfield2,chr(32),"") pcustomsubfield3js = replace(pcustomsubfield3,chr(32),"") pemailalert = getsettingkey("pemailalert") 'collect form data pEmail = getUserInput(request.form("email"),150) pEmail2 = EnigmaEncrypt(pEmail, enigmaPassword) pnamefordb = formatfordb(getUserInput(request.form("name"),150)) pname = request.form("name") if pname = "" then pname = "Subscriber" end if if pnamefordb = "" then pnamefordb = "Subscriber" end if paddress = formatfordb(getUserInput(request.form("address"),150)) pcity = formatfordb(getUserInput(request.form("city"),150)) pzip = formatfordb(getUserInput(request.form("zip"),150)) ppassword = formatfordb(getUserInput(request.form("password"),150)) if ppassword = "" then 'create a random password ppassword=randomNumber(99999999) end if pstate = formatfordb(getUserInput(request.form("stateCode"),150)) pcountry = formatfordb(getUserInput(request.form("country"),150)) pprefers = request.form("prefers") if pprefers = "" then pprefers = -1 end if pidlist = request.form("idList").Count dcustomsubfield1 = formatfordb(getUserInput(request.form(pcustomsubfield1js),255)) dcustomsubfield2 = formatfordb(getUserInput(request.form(pcustomsubfield2js),255)) dcustomsubfield3 = formatfordb(getUserInput(request.form(pcustomsubfield3js),255)) preferrer = request.form("referredby") if trim(preferrer)<>"" then paddnote = "-Invitation from: " &preferrer&"." else paddnote ="" end if pIP = request.ServerVariables("REMOTE_HOST") 'check for missing, invalid email if pEmail="" OR instr(pemail,"@")=0 OR instr(pemail,".")=0 then response.write "Please enter a valid email. Back." else 'Check if this subscriber is already in the subscribers list mySQL1="SELECT idEmail, email, name, prefers FROM subscribers WHERE email='"& pEmail& "'" call getFromDatabase(mySQL1, rstemp1, "optIn1") if not rstemp1.eof then 'means he is already in the subscribers list 'so send him to update his subscriptions response.redirect "showMeMySubscriptions.asp?subemail="&pEmail&"&message=You are already subscribed for our newsletter." else if pconfirmationsystem = "-1" then 'he is inserted as unverified. pverstatus ="0" else 'he is inserted as Verified. pverstatus ="-1" end if 'Step 1 - insert subscriber mySQL2="INSERT INTO subscribers (name, email, address, zip, state, country, city, subPassword, prefers, confirmed, dateSubscribed, customSubField1, customSubField2, customSubField3,ipSubscribed) VALUES ('"&pnamefordb&"', '"&pemail&"', '"&paddress&"', '"&pzip&"', '"&pstate&"', '"&pcountry&"', '"&pcity&"', '"&ppassword&"', "&pprefers&", "&pverstatus&", '"&myDay&"', '"&dcustomsubfield1&"', '"&dcustomsubfield2&"', '"&dcustomsubfield3&"', '"&pIP&"')" call updateDatabase(mySQL2, rstemp2, "optIn2") 'Step 2 - select the idEmail of the subscriber inserted mySQL4="SELECT idEmail FROM subscribers WHERE email='"&pEmail&"'" call getFromDatabase(mySQL4, rstemp4, "optIn4") pidemail = rstemp4("idEmail") For i = 1 to pidlist 'Step 3 - insert the combination of subscriber and list mySQL5="INSERT INTO listRecipients (idEmail, idList) VALUES ("&pidemail&", "&Request.form("idList")(i)&")" call updateDatabase(mySQL5, rstemp5, "optIn5") Next 'update admin statistics mySQL6="UPDATE adminStatistics set newSubscribers=newSubscribers+1" call updateDatabase(mySQL6, rstemp6, "optIn6") 'Now compose and send the messages 'IF the confirmation system is active if pconfirmationsystem = "-1" then 'build and send the email thats asks to confirm psubject = confirmationdata(pconfirmationemailsubject) psubject = psubject &paddnote if pprefers = "-1" then pbody = confirmationdata(pconfirmationemailbody) pemailcomponent = getsettingkey("pemailcomponenthtml") else pbody = confirmationdata(ptconfirmationemailbody) pemailcomponent = getsettingkey("pemailcomponent") end if 'we sent an email call sendMail(pCompany, pcompanyemail, pName, pEmail, psubject, pBody ) 'prepare the on-screen message pprefers = "-1" pmessage = confirmationdata(pconfirmationonscreenmessage) response.write pmessage else 'send the normal email and message psubject = confirmationdata(pwelcomeemailsubject) psubject = psubject &paddnote if pprefers = "-1" then pbody = confirmationdata(pwelcomeemailbody) pemailcomponent = getsettingkey("pemailcomponenthtml") else pbody = confirmationdata(ptwelcomeemailbody) pemailcomponent = getsettingkey("pemailcomponent") end if call sendMail(pCompany, pcompanyemail, pName, pEmail, psubject, pBody ) 'prepare the on-screen message pprefers = "-1" pmessage = confirmationdata(pwelcomeonscreenmessage) response.write pmessage end if 'Email alert if pemailalert = "-1" then call sendMail(pCompany, pcompanyemail, pCompany, pcompanyemail, "New subscriber", pname&" with email: "&pemail&" just subscribed in your newsletter.") end if end if end if 'missing, invalid email call closeDb() %>
|
||
|
|
|