
<!--#include file="../SQLconn.asp"-->

<link rel="stylesheet" type="text/css" href="../images/<%=request.cookies("imgdir")%>/css/style.css" media="all"/>


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



dim mysendto1
mysendto1=split(sendto,"|",-1,1)
 


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

			dim NewID 
			Set cmd = server.CreateObject("ADODB.Command")
			set Cmd.ActiveConnection = conn
			with Cmd
			   .CommandText = "incid"
			   .CommandType = 4
			   .parameters.Refresh
			   .parameters("@name") ="ALLID"
			   .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			 
		       rssended("havesee")="直发手机短信" 
			   rssended("短信提醒")="已短信提醒" 
			rssended.update
	end if
next
rssended.close
rsmessage.close

'发送短信到手机
   
        Set MyOAASPObj = Server.CreateObject("YFSchoolOApro2.YFSchoolDll2")
        call     MyOAASPObj.SendtoPhone_ziyou(NewID,message,request.cookies("tname"))
        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>
