<%@ LANGUAGE="VBSCRIPT" %> <% ' ######## Check to make Sure they have logged in ########### if Session("logged") <> "true" then Response.Redirect "bottom.asp" %> <% accessdb="message" cn="driver={Microsoft Access Driver (*.mdb)};" cn=cn & "dbq=" & server.mappath(accessdb) set my_conn= Server.CreateObject("ADODB.Connection") my_Conn.Open cn fp_Sqry = "Select mem_name From user where (f_name = '" & Session("uname") & "')" set usrname=my_conn.Execute (fp_sqry) %> <% 'get Multiple email addresses from To dim contactstring, x, y, ptr, contactArray(25) contactstring = Request.Form("to") contactstring = contactstring & "," y = 0 'index of contactArray() ptr= 1 for x = 1 to len(contactstring) if mid(contactstring,x,1) = "," then contactArray(y) = Trim(mid(contactstring,ptr,x-ptr)) ptr= x +1 y = y + 1 end if next 'get Multiple email addresses from Cc dim ccArray(15) contactstring = Request.Form("cc") contactstring = contactstring & "," ccy = 0 'index of ccArray() ptr= 1 for x = 1 to len(contactstring) if mid(contactstring,x,1) = "," then ccArray(y) = Trim(mid(contactstring,ptr,x-ptr)) ptr= x +1 ccy = ccy + 1 end if next %> <% ' ####### Check to See if Cc Exsisits If Request.Form("cc") <> "" then for x = 0 to 10 if contactArray(x) <> "" then fp_Sqry = "Select mem_name From user where mem_name = '" & ccArray(x) & "'" set ccRS=my_conn.Execute (fp_sqry) If ccRS.BOF and ccRS.EOF then No_TOc = "true" Else No_TOc = "false" End If End if next End If ' ######## Check to See if Recipient Exsists for x = 0 to 25 if contactArray(x) <> "" then fp_Sqry = "Select mem_name From user where mem_name = '" & contactArray(x) & "'" set RS=my_conn.Execute (fp_sqry) If RS.BOF and RS.EOF then No_TO = "true" Else No_TO = "false" End If End if next ' ######## Check to See if class Exsists If Request.Form("class") <> "" then fp_Sqry = "Select class From user where (class = '" & Request.Form("class") & "')" set RS=my_conn.Execute (fp_sqry) If RS.BOF and RS.EOF then No_grp = "true" Else No_grp = "false" End If End If %> Send Message <% If No_TO = "true" or No_TOc = "true" or NO_Grp = "true" then %>

Sorry! The Recipient Was unknown.

Please use your browsers 'back' button to try again

<% Else %> <% ' ################ Validate Input ################# If Request.Form("subject") = "" then m_subject = " " Else m_subject = Request.Form("subject") End If If Request.Form("mess") = "" then m_mess = " " Else m_mess = Request.Form("mess") End If m_mess = Replace(m_mess,"'", "''") m_subject = Replace(m_subject,"'", "''") ' ############## Send To Recipient ############## 'fp_Sqry = "Insert InTo message (from_u, to, mess, subject) Values ('" & Session("uname") & "', '" & Request.Form("to") & "', '" & m_mess & "', '" & m_subject & "')" for x = 0 to 25 if contactArray(x) <> "" then fp_Sqry = "Insert InTo message (from_u, to, mess, subject) Values ('" & Session("uname") & "', '" & contactArray(x) & "', '" & m_mess & "', '" & m_subject & "')" set RS=my_conn.Execute (fp_sqry) end if next If Request.Form("cc") <> "" then ' ############# Send To Cc.. ################## for x = 0 to 10 if contactArray(x) <> "" then fp_Sqry = "Insert InTo message (from_u, to, mess, subject) Values ('" & Session("uname") & "', '" & ccArray(x) & "', '" & m_mess & "', '" & m_subject & "')" set RS=my_conn.Execute (fp_sqry) end if next end If fp_qry = "Select mem_name From user where (class = '" & Request.Form("class") & "')" set to_name=my_conn.Execute (fp_qry) while not to_name.EOF If Request.Form("class") <> "" then ' ############# Send To Class ################## fp_Sqry = "Insert InTo message (from_u, to, mess, subject) Values ('" & Session("uname") & "', '" & to_name("mem_name") & "', '" & m_mess & "', '" & m_subject & "')" set RS=my_conn.Execute (fp_sqry) End If to_name.MoveNext wend to_name.close Set RS = nothing Set to_name= nothing %>

Your Message has been Sent

What would you like to do:

1. Go to Inbox

2. Compose new Message

<% End If %> <% ' ######## Close Database ############## Set RS = nothing set to_name=nothing %>