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



<%call head()
Call FortxtChat
Call saycarda("自建聊天室大厅")
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from Chat where roomadmin2<>0 order by id desc",conn,1,1
i=1
Do While Not rs.eof
'删除聊天室
  set rs1=server.CreateObject("ADODB.RecordSet")
  rs1.Open "select ID from Users where tjj >= '"&DateAdd("n", chatonline, Now())&"' and ChatID ="&rs("ID")&" order by tjj desc",conn,1,1
  reBeon = rs1.RecordCount
  rs1.close
  set rs1=nothing
IF reBeon=0 then
  conn.Execute("delete from Chat Where id="&rs("id"))
end if
rs.MoveNext
	i=i+1
	Loop
rs.close
set rs=nothing

'检查有几条新留言
dim newguest
newguest = 0
IF myid > 0 THEN
  newguest = ForNewGuest(myid)
END IF
if myid<>0 then
if newguest > 0 then
Response.write "<a href='../msgview.asp?sid="&sid&"&amp;saytk="&saytk&"'>您有"&newguest&"条新消息</a><br/>"& chr(13)
end if
response.write"欢迎您：<a href='../show.asp?sid="&sid&"&amp;saytk="&saytk&"'>"&myni&"</a><br/>"&chr(13)
else
Response.write "欢迎您:<a href='login.asp?saytk="&saytk&"'>登陆/注册</a><br/>"& chr(13)
end if
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from Chat Where gruid=0 and suxin<>0 order by id desc",conn,1,1
If Not rs.eof Then
	Dim PageSize,i
	PageSize=10						
	Dim Count,page,pagecount,gopage			
	gopage="index.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;"
	Count=rs.recordcount	
	page=int(request.QueryString ("page"))
	if page<=0 or page="" then page=1		
	pagecount=(count+pagesize-1)\pagesize	
        if page>pagecount then page=pagecount
	rs.move(pagesize*(page-1))
dim ggss
	For i=1 To PageSize     						
	If rs.eof Then Exit For
   Response.write ""&i+(page-1)*PageSize&"."
   Response.write "<a href=""chatroom.asp?id="&rs("id")&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"&ubb(rs("roomname"))&"("&rs("Chatnum")&")</a><br/>"

	rs.moveNext
 	Next
	if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下页</a>"
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上页</a>"
	if pagecount>1 then response.write "<br/><b>"&page&"</b>/"&pagecount&"页"
if saytk=1 then
response.write "<input name=""page"" format=""*N"" value="""&page&""" type=""text"" maxlength=""5"" emptyok=""true"" size=""3""/><a href="""&gopage&"page=$(page)"">跳转</a><br/>"
end if
Else
   Response.write "暂时没有聊天室！<br/>"
end if
rs.close
set rs=nothing
conn.close
set conn=Nothing
response.write"<a href='chataddFF.asp?sid="&sid&"&amp;saytk="&saytk&"'>我要建立</a><br/>"&chr(13)
   Response.write "---------"
   Response.write "<br/><a href='index.asp?sid="&sid&"&amp;saytk="&saytk&"'>聊天大厅</a>"&chr(13)
   %>
<!--#include file="../fanhui.asp"-->
<%call headsay()%>