% If not session("userisadmin") then Response.Redirect "error.asp?message=You dont have the authority to use this feature.." End If %>
|
<% If request("B2")="Send" Then sendmessage Else%> Contact Active Members Contact Blocked Members Subject :: |
<%
Sub sendmessage()
result = validate
if result = "" then
response.write "Sending Email to:
"
Set oRs = Server.CreateObject("ADODB.Recordset")
Set db = Server.CreateObject("ADODB.connection")
db.Open ConStr
If request("active") = "ON" Then mySQL = "select * from users where blocked=false;"
If request("blocked")= "ON" Then mySQL = "select * from users where blocked=true;"
If request("active") = "ON" AND request("blocked")= "ON" Then mySQL = "select * from users;"
oRs.Open mySQL, db, adOpenStatic, adLockOptimistic
while not oRs.EOF
Email = oRs.Fields("Email")
Name = oRs.Fields("Name")
body = request("body") & chr(13) & _
chr(13) & _
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" & chr(13) & _
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" & chr(13) & _
"This message was sent using " & sitename & chr(13) & _
siteurl & chr(13) & _
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" & chr(13) & _
"sender IP: " & Request.ServerVariables("REMOTE_ADDR")
subj = "[" & sitename & "] " & request("subject")
Sendmail Email, subj, body, siteEmail
response.write "" & Name & "
"
oRs.movenext
Wend
oRs.close
Set db = Nothing
Set oRs = Nothing
Response.write "
Press the BACK button to return."
else
response.redirect "error.asp?message=" & result & "Press the back button to try again."
end if
End Sub
Function validate
dim message
message = ""
Select Case ""
case request("subject")
message="You must write a Subject !"
case request("body")
message="You must write some thing !"
End select
If message = "" then
validate = ""
else
validate = false
message = message & "
"
validate = message
End If
End Function
%>