<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#include file="../forbbs.asp"-->
<%call head()
Call FortxtChat
Call saycardd("群发邀请")

dim reContent,face,ID
reContent=forbbs(request("reContent"))
id=request("id")

set rs=server.createobject("adodb.recordset")
rs.open "select roomname from Chat where ID="&ID,conn,1,1
if rs.eof then
  rs.close
  set rs=nothing
if saytk<>1 then
  Call Error("<title>发送邀请</title></head><body><body bgcolor="""&yanse12&"""><p>错误的聊天室ID")
else
  Call Error("<card title=""发送邀请""><p>错误的聊天室ID")
end if
end if
chatname=rs("roomname")
  rs.close
  set rs=nothing
  
face=request("face")
if face="" or Isnumeric(lid)=False then face=0
if reContent="" then
  Call Error("消息内容不能为空！")
  end if
if len(reContent)>1000 then
  Call Error("消息内容最多1000字！")
  end if
if id="" or Isnumeric(id)=False then
  Call Error("ID无效！")
  end if
  reContent="会员ID("&myid&")邀请您到(url=/bbs/chat/chatroom.asp?ID="&ID&"&amp;sid=[sid]&saytk=[saytk])"&chatname&"(/url)聊天室聊天啦！[br]"+reContent
  
dim objgbrs,ids
 set objgbrs=Server.CreateObject("ADODB.Recordset")
  objgbrs.open"select * from myfriend where cid="&myid&" order by id desc",conn,1,3
 Do While Not objgbrs.EOF
      ids=objgbrs("did")
      qfmsg
     objgbrs.MoveNext
  Loop
objgbrs.close
set objgbrs=nothing
Function qfmsg()
  sql="insert into guest(fid,sid,fnr,tou) values ("
  sql=sql & sqlstr(myid) & ","
  sql=sql & sqlstr(ids) & ","
  sql=sql & sqlstr(reContent) & ","
  sql=sql & sqlstr(face) & ")"
  Application.Lock
  conn.execute(sql)
  Application.Unlock
End function
function sqlstr(data)
sqlstr="'" & Replace(data,"'","'") & "'"
End function
conn.close
set conn=nothing
response.write"恭喜,群发邀请成功！"
Response.write "<br/><a href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回聊天</a>"&chr(13)
call head1()
%>