<%@LANGUAGE="VBSCRIPT"%> <% '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Spd E-Letter v4 ' © 2001, 2002 PensaWorks, inc. ' For help with this program, please visit http://www.pensaworks.com '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Access = "User" : Nav3 = "1" %> <% thisPage = Mid(request.servervariables("SCRIPT_NAME"), InstrRev(request.servervariables("SCRIPT_NAME"), "/") + 1) totalWidth = 0 if (request("action") = "step2" OR request("action") = "step3" OR request("action") = "step4" OR request("action") = "step5" OR request("action") = "step6") then action = lcase(request("action")) else action = "step1" if (request("frmMergeTo") <> "" AND isNumeric(request("frmMergeTo"))) then frmMergeTo = clng(request("frmMergeTo")) else frmMergeTo = 0 if (request("frmPurge") <> "" AND isNumeric(request("frmPurge"))) then frmPurge = clng(request("frmPurge")) else frmPurge = 1 if (request("frmFormat") <> "" AND isNumeric(request("frmFormat"))) then frmFormat = clng(request("frmFormat")) else frmFormat = 1 for each item in request("frmMergeFrom") if (frmMergeFrom = "") then frmMergeFrom = "," & item & "," else frmMergeFrom = frmMergeFrom & item & "," next if request("reset") <> "" then frmFormat = 1 frmPurge = 1 frmMergeTo = 0 frmMergeFrom = "" action = "step1" end if if action = "step2" and frmMergeFrom = "" then action = "step1" msg = 1 end if if action = "step3" and frmMergeTo = 0 then action = "step2" msg = 2 end if %> <%=ListName%> - Spd E-Letter Administration

List Merge

<% if msg = 1 then %>

Error: You must choose at least one list to merge from.

<% elseif msg = 2 then %>

Error: You must choose the list to merge into.

<% end if %> <% if action = "step1" then %>

Step 1 of 5

Please choose the list(s) you want to merge.

<% elseif action = "step2" then %>

Step 2 of 5

Please choose the list you want to merge into.

<% listWhereClause = listWhere(allowedLists, "ML_Lists.") listWhereClause2 = "" frmMergeFromArray = split(frmMergeFrom, ",") for i = 1 to (ubound(frmMergeFromArray) -1) if frmMergeFromArray(i) <> "" AND IsNumeric(frmMergeFromArray(i)) then listWhereClause2 = listWhereClause2 & " AND ListID <> " & frmMergeFromArray(i) end if next response.write listWhereClause %>
<% elseif action = "step3" then %>

Step 3 of 5

Please choose the options and settings for the merge.

Subscriber Purge:

> Do not purge subscribers from the merge lists
> Purge subscribers from the merge lists (Soft, nonpermanent delete)
> Purge subscribers from the merge lists (Hard, permanent delete)

Format Override:
> Leave as subscribers Choice
> Force all subscribers as Text only
> Force all subscribers as HTML only
Duplicates:
Duplicate subscribers will automatically be removed. 
<% elseif action = "step4" then %>

Step 4 of 5

Please confirm your merge options and then hit 'Finish'. The lists will then be merged.

Merge Lists:
<% frmMergeFromArray = split(frmMergeFrom, ",") for i = 1 to (ubound(frmMergeFromArray) -1) if frmMergeFromArray(i) <> "" AND IsNumeric(frmMergeFromArray(i)) then set getList = mlConn.Execute("SELECT * FROM ML_Lists WHERE ListID = " & frmMergeFromArray(i)) if (NOT getList.EOF) then response.write getList("ListName") if (i < (ubound(frmMergeFromArray) -1)) then response.write "
" set getList = nothing end if next %>
Merge into List:
<% set getList = mlConn.Execute("SELECT * FROM ML_Lists WHERE ListID = " & frmMergeTo) if (NOT getList.EOF) then response.write getList("ListName") set getList = nothing %>
Subscriber Purge:
<% if frmPurge = 3 then %>Purge subscribers from the merge lists (Hard, permanent delete)<% elseif frmPurge = 2 then %>Purge subscribers from the merge lists (Soft, nonpermanent delete)<% else %>Do not purge subscribers from the merge lists<% end if %>
Format Override:
<% if frmFormat = 3 then %>Force all subscribers as HTML only<% elseif frmFormat = 2 then %>Force all subscribers as Text only<% else %>Leave as subscribers choice<% end if %>
<% elseif action = "step5" then %>

Step 5 of 5

Merging your lists. Please wait while this process completes. Do not close your browser or hit refresh.

<% elseif action = "step6" then %>

The list merge is complete. If you wish to merge more lists, please click here.

<% else %>

No Action was specified. Redirecting to step 1

<% end if %>

<% '======================================= '= Actual Merge Logic ========================= '======================================= if action = "step5" then response.flush() onStep = 0 ' merge setup... frmMergeFromArray = split(frmMergeFrom, ",") for i = 1 to (ubound(frmMergeFromArray) -1) if frmMergeFromArray(i) <> "" AND IsNumeric(frmMergeFromArray(i)) then if allowedList(frmMergeFromArray(i), allowedLists) then if (selectSQL = "") then selectSQL = "ListID = " & frmMergeFromArray(i) else selectSQL = selectSQL & " OR ListID = " & frmMergeFromArray(i) end if end if next strSQL = "SELECT * FROM ML_Subscribers WHERE subRemoved = 0 AND (" & selectSQL & ")" set getRecords = Server.CreateObject("ADODB.Recordset") getRecords.ActiveConnection = mlConn getRecords.Source = strSQL getRecords.CursorType = 1 getRecords.LockType = 3 getRecords.Open() ' count total actions to be performed... totalSteps = (getRecords.recordcount + 1) ' do actions, and output while NOT getRecords.EOF onStep = onStep + 1 if NOT response.isclientconnected then response.end() else subName = getRecords("Name") subEmail = getRecords("Email") if frmFormat = frmFormat = 3 then subFormat = "HTML" elseif frmFormat = 2 then subFormat = "Text" else subFormat = getRecords("Format") end if ' do check... set dupCheck = mlConn.Execute("SELECT * FROM ML_Subscribers WHERE Email = '" & replace(subEmail, "'", "''") & "' AND ListID = " & frmMergeTo) if dupCheck.EOF then ' they don't already exist, load em in now insertSQL = "INSERT INTO ML_Subscribers " insertSQL = insertSQL & "(Name, Email, Format, SubscribedDate, ListID, numClicks, numReads, numBounces, numReplies, subRemoved)" insertSQL = insertSQL & " VALUES " insertSQL = insertSQL & "('" & replace(subName, "'", "''") & "','" & replace(subEmail, "'", "''") & "','" & replace(subFormat, "'", "''") & "'," & cfgDate & "," & frmMergeTo & ",0,0,0,0,0)" mlConn.Execute(insertSQL) end if doIt = doStatus(totalSteps, onStep, totalWidth) set dupCheck = nothing end if getRecords.movenext() wend ' purge lists? onStep = onStep + 1 if frmPurge = 2 then strSQL = "UPDATE ML_Subscribers SET subRemoved = 1, subRemovedDate = " & cfgDate & " WHERE subRemoved = 0 AND (" & selectSQL & ")" mlConn.Execute(strSQL) end if if frmPurge = 3 then strSQL = "DELETE " & delAddon & " FROM ML_Subscribers WHERE subRemoved = 0 AND (" & selectSQL & ")" mlConn.Execute(strSQL) end if doIt = doStatus(totalSteps, onStep, totalWidth) %> <% end if '======================================= '= Functions =============================== '======================================= function doStatus(totalSteps, onStep, totalWidth) totalPercent = round((onStep * 100) / totalSteps) 'response.write totalPercent & " - " & onStep & " - " & totalSteps & "
" & vbnewline & vbnewline do while totalWidth <= totalPercent response.write "" & vbnewline totalWidth = totalWidth + 1 response.flush() loop end function response.flush() thisTime = Now for i = 0 to 2 if response.IsClientConnected then thisTime = now do until Now > thisTime ' nothing loop %> <% response.flush() end if next %>