<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<% call head()
dim nam,roomadmin,txt,bbsid
nam=usb(request("nam"))
bbsid=usb(request("bbsid"))
if isnumeric(bbsid)=False then bbsid=0
dim zonejb
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select zonejb from ydbbs where id="&bbsid,conn,1,1
if rs.eof then
  Call Error("<card  title=""温馨提示""><p>不存在的记录！")
  end if
zonejb=rs("zonejb")
rs.close
set rs=nothing

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from Chat Where gruid="&bbsid&"  order by id desc",conn,1,1
If Not rs.eof Then
rs.close
set rs=nothing
  Call Error("<card  title=""温馨提示""><p>帮派聊天室已开放了！")
end if
rs.close
set rs=nothing

txt=usb(request("txt"))


call saycarda("开通帮派聊天室")

if nam="" then
  Call Error("名称不能为空！")
end if
dim chatjb
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select chatjb from twapp where id=1",conn,1,1
if rs.eof then
  Call Error("系统没有配置！")
  end if
chatjb=rs("chatjb")
rs.close
set rs=nothing

if zonejb<abs(chatjb) then
  Call Error("帮派金库"&getcent&"不足！")
  end if
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from chat",conn,1,2
rs.addnew
rs("roomname")=nam
rs("roomadmin")=myid
rs("roomadmin2")=0
rs("gruid")=bbsid
if txt<>"" then rs("title")=txt
rs.update
rs.close
set rs=nothing


'减币
conn.Execute("update ydbbs set zonejb=zonejb-"&abs(chatjb)&" Where id="&bbsid)

response.write"成功开通帮派聊天室<br/>"

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select id from chat where gruid="&bbsid,conn,1,1
if not rs.eof then
ID=rs("id")
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
   Response.write "<br/><a href=""chatroom.asp?id="&id&"&amp;saytk="&saytk&"&amp;sid="&sid&""">进入聊天室</a>"
   Response.write "<br/><a href=""../board.asp?bbsid="&id&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回帮派</a>"
%><!--#include file="../fanhui.asp"-->
<%call headsay%>