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

dim reContent,friendid,face,ID
reContent=forbbs(request("reContent"))
friendid=request("friendid")
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
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse12&"""><p>消息内容不能为空")
else
  Call Error("<card title=""发送邀请""><p>消息内容不能为空！")
  end if
end if
if len(reContent)>1000 then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse12&"""><p>消息内容最多1000字")
else
  Call Error("<card title=""发送邀请""><p>消息内容最多1000字！")
  end if
end if
if id="" or Isnumeric(id)=False then
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
if friendid="" or Isnumeric(friendid)=False then
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
if clng(friendid)=0 then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse12&"""><p>请选择好友")
else
  Call Error("<card title=""发送邀请""><p>请选择好友！")
  end if
end if
if clng(friendid)=myid then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse12&"""><p>不能给自己发邀请")
else
  Call Error("<card title=""发送邀请""><p>不能给自己发邀请！")
  end if
end if
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from myhait where jid="&friendid&" and bid="&myid,conn,1,1
if not rs.eof then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse12&"""><p>对方已把你加为黑名单")
else
  Call Error("<card title=""发送邀请""><p>对方已把你加为黑名单！")
  end if
end if
rs.close
set rs=nothing

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select id from [users] where id="&friendid,conn,1,1
if rs.eof then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse12&"""><p>没有这个会员")
else
  Call Error("<card title=""发送邀请""><p>没有这个会员！")
  end if
end if
rs.close
set rs=Nothing

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from [guest]",conn,1,2
rs.addnew
rs("sid")=friendid
rs("fid")=myid
rs("fnr")="会员ID("&myid&")邀请您到(url=/bbs/chat/chatroom.asp?ID="&ID&"&amp;sid=[sid]&saytk=[saytk])"&chatname&"(/url)聊天室聊天啦！[br]"+reContent
rs("tou")=face
rs.update
rs.close
set rs=Nothing
conn.close
set conn=nothing
call cardz("发送邀请","chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&"")
Response.write "发送邀请成功！"&chr(13)
Response.write "<br/><a href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回聊天</a>"&chr(13)
<%call head1()%>
%>