%
If Request.Form("name")<>"" and Request.Form("Subject")<>"" and Request.Form("Email")<>"" and Request.Form("Message")<>"" then
'Name = Request.Form("Name")
'Subject = Request("Subject")
Email = Request.Form("Email")
'Message = Request.Form("Message")
ICQ = Request.Form("ICQ")
Dim bsubject
bname = ReplaceBadwords(Request.Form("Name"))
bsubject = ReplaceBadwords(Request.Form("Subject"))
bmessage = ReplaceBadwords(Request.Form("Message"))
Function ReplaceBadwords(InputComments)
dim badchars, newchars, i
badchars = array("buy","hot","cheap", "video", "cock", "tit","mature", "sex", "xxx", "movie", "porn", "adult", "penis", "porno", "teen", "mature", "boob", "fuck", "suck", "dick", "www", "babe", "pill", "nude", "erotic", "blowjob", "booty", "free", "mobile", "viagra", " 0 Then
NTop = RS("NTop")
Else
NTop = 0
End If
RS.Close
' If HTML not allowed remove it
If not Application("WebBoardAllowHTML") Then
oldstring = Message
newstring = ""
for i=1 to Len(oldstring)
Select Case HTML
Case True
If Mid(oldstring, i, 1) = ">" Then
HTML = False
End If
Case Else
If Mid(oldstring, i, 1) = "<" Then
HTML = True
Else
newstring = newstring & Mid(oldstring, i, 1)
End If
End Select
Next
Message = newstring
'Detect http:// and create link to it
oldstring = Message
newstring = ""
for i = 1 to Len(oldstring) - 7
If LCASE(Mid(oldstring, i, 7)) = "http://" Then
for j = i to Len(oldstring)
If Mid(oldstring,j,1) = " " or Mid(oldstring,j,1) = vbcr Then
Exit For
End If
next
strLink = Mid(oldstring,i,(j-i))
newstring = newstring & "" & strLink & "" & Mid(oldstring,j,1)
i = i + (j-i)
Else
newstring = newstring & Mid(oldstring,i,1)
End If
next
Message = newstring & Mid(oldstring,i,i+7)
End If
PostType = Request("PostType")
Select Case PostType
Case "new"
ParentId = 0
SortCd = int(NTop) + 1
MajorSort = SortCd
Select Case len(SortCd)
Case 1
SortCd = "000" & SortCd
Case 2
SortCd = "00" & SortCd
Case 3
SortCd = "0" & SortCd
End Select
Case "reply"
ParentId = int(Request("ParentId"))
Cmd.CommandText="Select SortCd, MajorSort from Message where MessageId = " & ParentId
RS.Open Cmd, , 0, 1
Prefix = RS("SortCd")
MajorSort = RS("MajorSort")
RS.Close
Cmd.CommandText="Select COUNT(MessageId) as [NPeer] from Message where ParentId = " & ParentId
RS.Open Cmd, , 0, 1
NPeer = RS("NPeer")
RS.Close
SortCd = int(NPeer) + 1
Select Case len(SortCd)
Case 1
SortCd = "000" & SortCd
Case 2
SortCd = "00" & SortCd
Case 3
SortCd = "0" & SortCd
End Select
SortCd = Prefix & "." & SortCd
Message = Message & vbcr & vbcr & "***---REPLIED TO MESSAGE BELOW---***" & vbcr & Request("OldMessage")
EmailMessage = Message
oldstring = Message
newstring = ""
for i=1 to Len(oldstring)
If Mid(oldstring, i, 1) = vbCr Then
newstring = newstring & "
"
Else
newstring = newstring & Mid(oldstring, i, 1)
End If
Next
Message = newstring
Cmd.CommandText="Select Email From Message Where MessageId = " & ParentId
RS.Open Cmd, , 0, 1
EmailTo = RS("Email")
RS.Close
EmailBody = Name & "(" & Email & ") has replied to a message you posted " & vbcr & _
"------------------------------------------------------" & vbcr & _
vbcr & "SUBJECT : " & Subject & " " & Date & " " & Time & _
vbcr & "MESSAGE : " & EmailMessage & _
vbcr & vbcr & "------------------------------------------------------" & _
vbcr & "Go to http://tnhealth.org to view all the details"
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "[email protected]"
objMail.To = EmailTo
objMail.Subject = "Message Board"
objMail.Body = EmailBody
'objMail.Send
Set objMail = Nothing
End Select
Cmd.CommandText="Select * from Message"
RS.Open Cmd, , 2, 2
RS.AddNew
RS("ParentId") = ParentId
RS("Name") = bname
RS("Email") = Email
RS("Subject") = bsubject
RS("Description") = bmessage
RS("MessageDate") = Date & " " & Time
RS("SortCd") = SortCd
RS("MajorSort") = MajorSort
If ICQ <> "" Then
RS("ICQ") = ICQ
End IF
RS.Update
RS.Close
Select Case PostType
Case "new"
'Response.Redirect("default.asp")
Response.Write("")
Response.Write "
" Response.Write "
| "
Response.Write " | "
Response.Write ""
Response.Write "
| "
Response.Write " "
Response.Write " |
"
Response.Write "
"
Response.Write "
"
Response.Write "
| "
Response.Write " Your Message will get displayed once it is approved by the administrator.. |
| " Response.Write "" Response.Write " |
" Case "reply" Response.Write("") Response.Write "
" Response.Write "
| "
Response.Write " | "
Response.Write ""
Response.Write "
| "
Response.Write " "
Response.Write " |
"
Response.Write "
"
Response.Write "
"
Response.Write "
| "
Response.Write " Your Message will get displayed once it is approved by the administrator.. |
| " Response.Write "" Response.Write " |
" 'Response.Redirect("messageDetail.asp?MessageId=" & ParentId) End Select else Response.Write "
" Response.Write "
| "
Response.Write " | "
Response.Write ""
Response.Write "
| "
Response.Write " "
Response.Write " |
"
Response.Write "
"
Response.Write "
"
Response.Write "
| "
Response.Write " Please Enter all the mandatory fields " Response.Write " |
| " Response.Write "" Response.Write " |
" end if %>