<% Dim Conn Dim rsSelection Dim SQL Dim ReplyText Dim bNotify Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open(session("ConnDB")), session("UID"), session("PWD") ' Get selection record. For security, limit to ones for this MemberID set rsSelection = Server.CreateObject("ADODB.RecordSet") sql = "SELECT * FROM Selections WHERE (SelectID=" & request("selectid") & ") AND (SelectedMemberID=" & Session("MemberID") & ");" rsSelection.Open sql, Conn, adOpenStatic, adLockOptimistic ' Check recordset; could have a member deactivating and deleting record if (Not rsSelection.EOF) then ' Use original dates to calculate whether to generate email notification (not twice in one day) if (IsNull(rsSelection("selectedmessagedate"))) then ' First message ever sent bNotify = TRUE elseif (IsNull(rsSelection("selectormessagedate"))) then ' Not the first one sent, but never any response bNotify = FALSE else bNotify = (rsSelection("selectedmessagedate") < rsSelection("selectormessagedate")) bNotify = (bNotify AND (CDate(rsSelection("selectedmessagedate")) <> Date())) end if ' Update the date, time and status fields rsSelection("SelectStatus") = CInt(request("selectstatus")) rsSelection("selectedmessagedate") = Now() ' Update the text field if RE_YES and text has changed ReplyText = StripChars (request("ReplyText")) if (CInt(request("selectstatus")) = RE_YES) AND (ReplyText <> "") then rsSelection("SelectedMessage") = ReplyText if (bNotify) then EmailNotify NOTIFY_MSG, rsSelection("SelectorMemberID"), "Visit http://www.FunLA.com to read your message and reply today!" end if ' Write the recordset and return rsSelection.Update end if Conn.Close SafeRedir ("Member.asp") %>