<link rel="stylesheet" type="text/css" href="../css/style.css" />
<!--#include file="../SQLconn.asp"-->

<%
    sendtype=request("sendtype")
    sendto=request("sendto")
    message=request("CONTENT")



dim mysendto1
mysendto1=split(sendto,"|",-1,1)
for each sendtoinf in mysendto1
      set rscheck=server.createobject("adodb.recordset")
      rscheckSQL="select * from teachers where TName ='"&sendtoinf&"'" 
      rscheck.open rscheckSQL,conn,1,3
	  if  rscheck.eof and  rscheck.bof then
	      response.redirect   "FindError.asp?tname="&sendtoinf
	  end if 
next


'取得最后一个ID   从存储过程取得emailid  公用

			dim NewID 
			Set cmd = server.CreateObject("ADODB.Command")
			set Cmd.ActiveConnection = conn
			with Cmd
			   .CommandText = "incid"
			   .CommandType = 4
			   .parameters.Refresh
			   .parameters("@name") ="emailid"
			   .execute
			   NewID = .parameters("@id")
			end with


'发送文件到数据库
set rsmessage=server.createobject("adodb.recordset")
rsmessagesql="select * from message where (mid is null)" 
rsmessage.open rsmessagesql,conn,1,3
rsmessage.addnew

rsmessage("mid")=NewID
rsmessage("message")=message
rsmessage("updatetime")=now()
rsmessage("upname")=request.cookies("tname")
strip=Request.ServerVariables("REMOTE_ADDR")
rsmessage("upip")=strip
rsmessage.update

 


'标记发送文件给个人
set rssended=server.createobject("adodb.recordset")
rssendedsql="select * from seemessage where (sid is null)" 
rssended.open rssendedsql,conn,1,3

dim mysendto
mysendto=split(sendto,"|",-1,1)
for each sendtoinf in mysendto

   set Rscheck=Conn.Execute("select * from seemessage where  mid='"&NewID&"' and  sendto='"&sendtoinf&"'")
	if   Rscheck.eof and   Rscheck.bof then  '检查是否重发

			rssended.addnew
			rssended("mid")=NewID
			rssended("sendto")=sendtoinf
			if sendtype="shouji" then
			   rssended("havesee")="已发手机" 
			end	 if	
			rssended.update
	end if
next
rssended.close
rsmessage.close

'发送短信到手机
    if sendtype="shouji" then
        Set MyOAASPObj = Server.CreateObject("YFSchoolOApro2.YFSchoolDll2")
        call     MyOAASPObj.SendToPhone(NewID,message,request.cookies("tname"))
        set MyOAASPObj=nothing
	end if
	
	
	     Set MyOAASPObj = Server.CreateObject("YFSchoolOApro.YFSchoolDll")
       call  MyOAASPObj.SendToOAJingLing("短信",NewID)
	     set MyOAASPObj=nothing

'response.redirect   "Message.asp?seetype=已发短信&curpage=1"
%>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="center" class="STYLE1">短信成功送达！<a href="send.asp" target="_self">继续发送</a></p>
<p align="center" class="STYLE1">&nbsp;</p>
<p align="center">
  <input name="button" type="button" class="topanniu" onclick="location='../main.asp';"  value="返回首页" />
</p>
