%
If Not session("admin_loggedin" & strSUnique) = Session.SessionID then Response.Redirect "default.asp"
Dim title, subject, body, ID, isHTML
If Request.Querystring.Count = 1 then
showTempl = Request.Querystring.Item(1)
End If
If Request.Form("Flag") = 1 then
newsTemplate = showTempl
strTempl = "SELECT " & tablPfx & "Template.subject," & tablPfx & "Template.body FROM " & tablPfx & "Template WHERE " & tablPfx & "Template.tname='" & newsTemplate & "';"
set rs = objConn.Execute(strTempl)
If not rs.EOF then
uSubject = rs(0)
uBody = rs(1)
rs.close
uBody = Replace(uBody, ":MyWeb:", web_site)
uBody = Replace(uBody, ":WebNm:", web_name)
uBody = Replace(uBody, ":Date:", Now)
If Request.Form("isHTML") = 1 then isHTML = True
Set re = New RegExp
re.Global = False
re.IgnoreCase = False
re.pattern = "(?::top\d+:)"
If re.test(uBody) then
Set match_var = re.Execute(uBody)(0)
match_var = Replace(match_var, ":", "")
match_var = Replace(match_var, "top", "", 1, 1, 1)
If IsNumeric(match_var) then
uBody = Replace(uBody, ":""top" & match_var & ":", "", 1, 1, 1)
T = 1
If mysql then
strSQL = "SELECT subject, adID FROM " & tablPfx & "Ads WHERE (status = 1) ORDER BY pdate DESC LIMIT 0," & match_var & ";"
Else: strSQL = "SELECT TOP " & match_var & " subject, adID FROM " & tablPfx & "Ads WHERE (status = 1) ORDER BY pdate DESC;"
End If
set rs = objConn.Execute(strSQL)
If not rs.EOF then
If isHTML then strPop = "
"
Do While not rs.EOF
If T > match_var then Exit Do
title = rs(0)
If isHTML then
strPop = strPop & "
"
Else: strPop = strPop & " " & title & vbcr & " " & web_site & "viewad.asp?id=" & rs(1) & vbcr & vbcr
End If
rs.MoveNext
T = T + 1
Loop
If isHTML then strPop = strPop & "
"
End If
rs.close
End If
If Len(strPop) > 0 then uBody = re.Replace(uBody, strPop)
End If
uSubject = Replace(uSubject, ":WebNm:", web_name, 1, 1, 1)
If Request.Form("test") = "1" then
uBody = Replace(uBody, ":uEmail:", admin_email, 1, 1, 1)
uBody = Replace(uBody, ":uNick:", "Admin", 1, 1, 1)
uSubject = Replace(uSubject, ":uNick:", "Admin", 1, 1, 1)
Call sendEmail(admin_email, notify_email, uSubject, uBody)
Response.Write "
The current TEST News Letter was Emailed to the Email specified as 'Admin Email'.
"
Else
strSQL = "SELECT email,nick,credits FROM " & tablUPfx & "User WHERE elist = 1;"
set rs = objConn.Execute(strSQL)
If not rs.EOF then
Do While Not rs.EOF
uEmail = CryptText(rs(0), key, True)
uNick = rs(1)
uCred = rs(2)
sBody = Replace(uBody, ":uEmail:", uEmail, 1, 1, 1)
sBody = Replace(sBody, ":uNick:", uNick, 1, 1, 1)
sBody = Replace(sBody, ":adCred:", uCred, 1, 1, 1)
sSubject = Replace(uSubject, ":uNick:", uNick, 1, 1, 1)
Call sendEmail(uEmail, notify_email, sSubject, sBody)
rs.MoveNext
Loop
Response.Write "
The current News Letter was Emailed to all users who had chosen to receive regular updates.
"
Else: Response.Write "
There are no users in Email list.
"
End If
rs.close
End If
Else: Response.Write "
Template cannot be found!
"
End If
End If
strTempl = "SELECT " & tablPfx & "Template.* from " & tablPfx & "Template WHERE type=2;"
set rs = objConn.Execute(strTempl)
Do while not rs.EOF
template = rs("tname")
Select Case showTempl
Case ""
showTempl = template
getTheRest
strTemplate = ""
Case else
If showTempl = template then
getTheRest
strTemplate = strTemplate & ""
Else: strTemplate = strTemplate & ""
End If
End Select
rs.MoveNext
Loop
rs.close
Sub getTheRest()
title = rs("title")
subject = rs("subject")
body = rs("body")
If Not Application("isHTML" & strUnique) = "1" then
body = Server.HTMLEncode(body)
body = Replace(body, vbCrLf, " ")
End If
ID = rs("ID")
End Sub
%>