<%@LANGUAGE="VBSCRIPT"%> <% If Request.QueryString("SUBMIT") = "POST" then 'submit = post ----> codes for posting a new message %> <% if(Request.QueryString("FOR_ID") <> "") then cmdPost__for_id = Request.QueryString("FOR_ID") if(Request.QueryString("MSG_AUTHOR") <> "") then cmdPost__msg_author = SESSION("MM_Username") if(Request.QueryString("MSG_SUBJECT") <> "") then cmdPost__msg_subject = Request.QueryString("MSG_SUBJECT") if(Request.QueryString("MSG_BODY") <> "") then cmdPost__msg_body = Request.QueryString("MSG_BODY") if(Request.QueryString("EMAIL_ME") <> "") then cmdPost__msg_email = Request.QueryString("EMAIL_ME") %> <% 'codes to insert a new topic into MESSAGES table set cmdPost = Server.CreateObject("ADODB.Command") cmdPost.ActiveConnection = MM_conn_STRING cmdPost.CommandText = "INSERT INTO MESSAGES (FOR_ID, MSG_AUTHOR, MSG_SUBJECT, MSG_BODY, EMAIL_ME) VALUES (" + Replace(cmdPost__for_id, "'", "''") + ", '" + Replace(cmdPost__msg_author, "'", "''") + "', '" + Replace(cmdPost__msg_subject, "'", "''") + "', '" + Replace(cmdPost__msg_body, "'", "''") + "', '" + Replace(cmdPost__msg_email, "'", "''") + "') " cmdPost.CommandType = 1 cmdPost.CommandTimeout = 0 cmdPost.Prepared = true cmdPost.Execute() %> <% ' codes to insert LAST_POST and increase 1 to TOPIC_COUNT in the FORUMS table set cmdPostCount = Server.CreateObject("ADODB.Command") cmdPostCount.ActiveConnection = MM_conn_STRING cmdPostCount.CommandText = "UPDATE FORUMS SET FOR_TOPIC_COUNT = FOR_TOPIC_COUNT + 1, FOR_LAST_POST = NOW() WHERE FOR_ID = " + Replace(cmdPost__for_id, "'", "''") + " " cmdPostCount.CommandType = 1 cmdPostCount.CommandTimeout = 0 cmdPostCount.Prepared = true cmdPostCount.Execute() Set cmdPos = nothing Set cmdPostCount = nothing %> <% Response.Redirect "messages.asp?for_id=" & cmdPost__for_id %> <% End If 'submit = post ----> codes for posting a new message %> <% If Request.QueryString("SUBMIT") = "REPLY" then 'submit = post ----> codes for posting a new message %> <% if(Request.QueryString("REP_AUTHOR") <> "") then cmdReply__rep_author = SESSION("MM_Username") if(Request.QueryString("REP_BODY") <> "") then cmdReply__rep_body = Request.QueryString("REP_BODY") if(Request.QueryString("EMAIL_ME") <> "") then cmdReply__rep_email = Request.QueryString("EMAIL_ME") if(Request.QueryString("MSG_ID") <> "") then cmdReply__msg_id = Request.QueryString("MSG_ID") if(Request.QueryString("FOR_ID") <> "") then cmdReply__for_id = Request.QueryString("FOR_ID") %> <% 'codes to insert a new reply into REPLIES table set cmdReply = Server.CreateObject("ADODB.Command") cmdReply.ActiveConnection = MM_conn_STRING cmdReply.CommandText = "INSERT INTO REPLIES (MSG_ID, REP_AUTHOR, REP_BODY, EMAIL_ME) VALUES (" + Replace(cmdReply__msg_id, "'", "''") + ", '" + Replace(cmdReply__rep_author, "'", "''") + "', '" + Replace(cmdReply__rep_body, "'", "''") + "', '" + Replace(cmdReply__rep_email, "'", "''") + "') " cmdReply.CommandType = 1 cmdReply.CommandTimeout = 0 cmdReply.Prepared = true cmdReply.Execute() %> <% ' codes to insert FOR_LAST_POST and increase 1 to FOR_REP_COUNT in the FORUMS table set cmdForRepCount = Server.CreateObject("ADODB.Command") cmdForRepCount.ActiveConnection = MM_conn_STRING cmdForRepCount.CommandText = "UPDATE FORUMS SET FOR_REPLY_COUNT = FOR_REPLY_COUNT + 1, FOR_LAST_POST = NOW() WHERE FOR_ID = " + Replace(cmdReply__for_id, "'", "''") + " " cmdForRepCount.CommandType = 1 cmdForRepCount.CommandTimeout = 0 cmdForRepCount.Prepared = true cmdForRepCount.Execute() %> <% ' codes to insert MSG_LAST_POST and increase 1 to MSG_REPLY_COUNT in the FORUMS table set cmdMsgRepCount = Server.CreateObject("ADODB.Command") cmdMsgRepCount.ActiveConnection = MM_conn_STRING cmdMsgRepCount.CommandText = "UPDATE MESSAGES SET MSG_REPLY_COUNT = MSG_REPLY_COUNT + 1, MSG_LAST_POST = NOW() WHERE MSG_ID = " + Replace(cmdReply__msg_id, "'", "''") + " " cmdMsgRepCount.CommandType = 1 cmdMsgRepCount.CommandTimeout = 0 cmdMsgRepCount.Prepared = true cmdMsgRepCount.Execute() set rsEmail = Server.CreateObject("ADODB.Recordset") rsEmail.ActiveConnection = MM_conn_STRING rsEmail.Source = "select p_users.p_email,p_users.p_user,MESSAGES.MSG_ID,MESSAGES.FOR_ID from (p_users INNER JOIN MESSAGES on p_users.p_user = MESSAGES.MSG_AUTHOR) WHERE MESSAGES.MSG_ID = " + Replace(cmdReply__msg_id, "'", "''") + " AND MESSAGES.EMAIL_ME = 'YES' AND MSG_AUTHOR <> '" + Replace(cmdReply__rep_author, "'", "''") + "'" rsEmail.CursorType = 0 rsEmail.CursorLocation = 2 rsEmail.LockType = 3 rsEmail.Open() rsEmail_numRows = 0 If Not rsEmail.EOF Or Not rsEmail.BOF Then uemail = rsEmail("p_email") userid = rsEmail("p_user") MSG_ID = rsEmail("MSG_ID") FOR_ID = rsEmail("FOR_ID") body = "Hello " & userid & vbCrLf & vbCrLf body = body & "A new reply has been posted in the message board. " & vbCrLf & vbCrLf body = body & weburl & "msgDetail.asp?msg_id=" & MSG_ID & ("&for_id=") & FOR_ID & vbCrLf Dim objCDO, objConfig set objCDO = createobject("cdo.message") set objConfig = createobject("cdo.configuration") ' Setting the SMTP Server Set Flds = objConfig.Fields Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" Flds.update Set objCDO.Configuration = objConfig objCDO.To = uemail objCDO.From = webemail objCDO.Subject = "New reply in the message board!" objCDO.TextBody = body objCDO.fields.update objCDO.Send set objCDO = nothing set objConfig = nothing elseIf rsEmail.EOF Or rsEmail.BOF Then userid = "$" end if set rsEmail2 = Server.CreateObject("ADODB.Recordset") rsEmail2.ActiveConnection = MM_conn_STRING rsEmail2.Source = "select distinct p_users.p_email,p_users.p_user from (p_users INNER JOIN REPLIES on p_users.p_user = REPLIES.REP_AUTHOR) WHERE REPLIES.MSG_ID = " + Replace(cmdReply__msg_id, "'", "''") + " AND REPLIES.EMAIL_ME = 'YES' AND REP_AUTHOR <> '" + Replace(cmdReply__rep_author, "'", "''") + "' AND REP_AUTHOR <> '" + Replace(userid, "'", "''") + "'" rsEmail2.CursorType = 0 rsEmail2.CursorLocation = 2 rsEmail2.LockType = 3 rsEmail2.Open() rsEmail2_numRows = 0 Dim repeat2__numRows repeat2__numRows = -1 Dim repeat2__index repeat2__index = 0 rsEmail2_numRows = rsEmail2_numRows + repeat2__numRows While ((repeat2__numRows <> 0) AND (NOT rsEmail2.EOF)) uemail2 = rsEmail2("p_email") userid2 = rsEmail2("p_user") body2 = "Hello " & userid2 & vbCrLf & vbCrLf body2 = body2 & "A new reply has been posted in the message board. " & vbCrLf & vbCrLf body2 = body2 & weburl & "msgDetail.asp?msg_id=" & cmdReply__msg_id & ("&for_id=") & cmdReply__for_id & vbCrLf Dim objCDO2, objConfig2 set objCDO2 = createobject("cdo.message") set objConfig2 = createobject("cdo.configuration") ' Setting the SMTP Server Set Flds = objConfig2.Fields Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" Flds.update Set objCDO2.Configuration = objConfig2 objCDO2.To = uemail2 objCDO2.From = webemail objCDO2.Subject = "New reply in the message board!" objCDO2.TextBody = body2 objCDO2.fields.update objCDO2.Send set objCDO2 = nothing set objConfig2 = nothing repeat2__index=repeat2__index+1 repeat2__numRows=repeat2__numRows-1 rsEmail2.MoveNext() Wend %> <% rsEmail.Close() rsEmail2.Close() Set rsEmail = nothing Set rsEmail2 = nothing Set cmdReply = nothing Set cmdForRepCount = nothing Set cmdMsgRepCount = nothing %> <% Response.Redirect "msgDetail.asp?msg_id=" & cmdReply__msg_id & "&for_id=" & cmdReply__for_id %> <% End If 'submit = post ----> codes for posting a new reply %>