<%= OutputCSS() %>
Mail List Builder :       Help

<% Dim objFSO, objRS, strList, totalemail, i, strMailList, backupfile, maillistfile, adminuploadfolder, selectedGroup Dim withName, colDelimiter, rowDelimiter, strSQLwithName, strSQLwithoutName, strSQLcheckCount, strSQL colDelimiter = " <" rowDelimiter = ">" adminuploadfolder = server.mappath("upfiles/0/") maillistfile = server.mappath("upfiles/0/maillist.lst") backupfile = server.mappath("upfiles/0/maillist.BAK") withName = request.form("submit") if withName <> "" then set objRS = Server.CreateObject("adodb.recordset") set objFSO = Server.CreateObject("Scripting.FileSystemObject") strList = "" ' response.write withName ' response.end SELECT Case request.form("DO") CASE "all" strSQL = "SELECT #columns# FROM pgd_Members WHERE (mem>0 and Banned<>1 and regStatus=0)" CASE "groupinclude" selectedGroup = request.form("groupi") if selectedGroup = "" then response.write ("There is an error in your selection. Please make sure you select at least one group.

") response.end end if strSQL = "SELECT #columns# FROM pgd_Members WHERE ((mem>0 and Banned<>1 and regStatus=0) AND "&_ "(Mem in ("&_ "SELECT DISTINCT Mem FROM pgd_GroupMember WHERE GID in ("& selectedGroup & ")))" &_ ")" ' response.write strSQL ' response.end CASE "groupexclude" selectedGroup = request.form("groupe") if selectedGroup = "" then response.write ("There is an error in your selection. Please make sure you select at least one group.

") response.end end if strSQL = "SELECT #columns# FROM pgd_Members WHERE ((mem>0 and Banned<>1 and regStatus=0) AND "&_ "(Mem not in ("&_ "SELECT DISTINCT Mem FROM pgd_GroupMember WHERE GID in ("& selectedGroup & ")))" &_ ")" CASE "others" if request.form("who") = "banned" then strSQL = "SELECT #columns# FROM pgd_Members WHERE (mem>0 and Banned=1 and regStatus=0)" else strSQL = "SELECT #columns# FROM pgd_Members WHERE (mem>0 and Banned<>1 and regStatus<>0)" end if END SELECT strSQLwithName = replace(strSQL,"#columns#", "login, Email") strSQLwithoutName = replace(strSQL,"#columns#", "Email") strSQLcheckCount = replace(strSQL,"#columns#", "count(Email) as 'count'") with objRS .open strSQLcheckCount, datastore, , , adCmdText totalemail = .fields("count") 'response.write totalemail .close if Lcase(withname) = "mail list with name" then .open strSQLwithName, datastore, , , adCmdText if not (.eof or .bof) then _ strList = .getString(adClipString,,colDelimiter,rowDelimiter&vbcrlf,"") .close else .open strSQLwithoutName, datastore, , , adCmdText if not (.eof or .bof) then _ strList = .getString(adClipString,,"",vbcrlf,"") .close end if end with set objRS = nothing if strList <> "" then with objFSO if not .folderexists(adminuploadfolder) then .createfolder(adminuploadfolder) end if if not .fileexists(maillistfile) then set strMailList = .createtextfile(maillistfile) else .copyfile maillistfile, backupfile, True set strMailList = .createtextfile(maillistfile) response.write ("Mail List File already exists, backup created as """&backupfile&"""

") end if strMailList.write(strList) strMailList.close end with %> Mail List Created Successfully, there are currently <%= totalemail%> names in your list.
Take a look? Click here

It is advisable to delete the mail list after you download the list to your desktop to prevent unauthorized person to obtain the list.
<% else response.write ("You don't have any members yet.

") end if set objFSO = nothing elseif request("delete")<>"" then set objFSO = Server.CreateObject("Scripting.FileSystemObject") with objFSO if .fileexists(maillistfile) then .DeleteFile maillistfile, true if .fileexists(backupfile) then .DeleteFile backupfile, true end with set objFSO = nothing response.write ("Mail List Files deleted successfully.

") end if '====================generate user groups======================== set objRS = server.createobject("adodb.recordset") Dim arrUserGroups With objRS .open "Select Distinct U.GID, U.GName "&_ " FROM pgd_UserGroup U" _ , datastore, , , adCmdText if not (.eof and .bof) then arrUserGroups = .getrows .close End With set objRS = nothing %>
Mail List Builder
> class="radiocheck"> >Option 1: Generate list for all users:
(Note: all banned users and unregistered users are excluded)
>
> class="radiocheck"> >Option 2: Generate list from the following groups: (multiple groups allowed)
(Note: all banned users and unregistered users are excluded)
<% if isArray(arrUserGroups) then for i=0 to ubound(arrUserGroups,2) %> <%= arrUserGroups(1,i) %> <% next end if %>
>
> class="radiocheck"> > Option 3: Generate list for all users but not the users in the following groups: (multiple groups allowed)
(Note: all banned users and unregistered users are excluded)
<% if isArray(arrUserGroups) then for i=0 to ubound(arrUserGroups,2) %> <%= arrUserGroups(1,i) %> <% next end if %>
>
> class="radiocheck"> >Option 4: Generate list for banned users or unregistered users:
Banned users    who haven't passed the registration process