<!--#include file="inc.asp"-->
<!--#include file="inc/Cls_Brower.asp"-->
<%
Dim PageString
BBS94KK.Head "首页"
If BBS94KK.Info(20)="1" then ShowInfo()

ShowNewHot()


ShowBoard()
If BBS94KK.Info(21)="1" then PageString=PageString&ShowOnline()
Response.Write PageString &"<iframe name='hiddenframe' frameborder='0'  height='0' id='hiddenframe'></iframe>"
If BBS94KK.Info(22)="1" then ShowBirthday()
If BBS94KK.Info(23)="1" then ShowLink()
BBS94KK.Footer()
Set BBS94KK = Nothing


Sub ShowInfo()
	With BBS94KK
	Dim S,OnlingType
	If .FoundUser Then
		S = .ReadSkins("用户信息")
		If Session(CacheName & "MyInfo")(11)="1" Then
			S=Replace(S,"{用户头像}","<img src='http://qqshow-user.tencent.com/"&Session(CacheName & "MyInfo")(10)&"/11/'>")
		Else
			S=Replace(S,"{用户头像}","<img src="&Session(CacheName & "MyInfo")(12)&" width="&Session(CacheName & "MyInfo")(13)&" height="&Session(CacheName & "MyInfo")(14)&" >")
		End if
		If .MyHidden="0" Then
			OnlingType="隐身中"
		Else
			OnlingType="在线中"
		End If
		S=Replace(S,"{用户名称}","<a href='UserInfo.asp' title='查自己的资料信息'>"&.MyName&"</a>")
		S=Replace(S,"{在线状态}",OnlingType)
		S=Replace(S,"{帖数}",Session(CacheName & "MyInfo")(4))
		S=Replace(S,"{积分数}",Session(CacheName & "MyInfo")(6))
		S=Replace(S,"{金钱数}",Session(CacheName & "MyInfo")(7))
		S=Replace(S,"{等级}",Session(CacheName & "MyGradeInfo")(2))
	Else
		S = .ReadSkins("游客信息")
	End If 
	S=Replace(S,"{总帖数}",.InfoUpdate(0))
	S=Replace(S,"{主题数}",.InfoUpdate(1))
	S=Replace(S,"{今日帖数}",.InfoUpdate(2))
	S=Replace(S,"{昨日帖数}",.InfoUpdate(3))
	S=Replace(S,"{最高日帖数}",.InfoUpdate(4))
	S=Replace(S,"{会员数}",.InfoUpdate(5))
	S=Replace(S,"{新会员名称}",.InfoUpdate(6))
	If .Info(14)="1" Then
		S=Replace(S,"{验证码}",BBS94KK.GetSafeCode)
	Else
		S=Replace(S,"{验证码}","")
	End If
	S=Replace(S,"{公告}",.Placard(0))
	Response.Write S
	End With
End Sub

Sub ShowBoard()
	Dim Board,Rs,i,BigBoard,BoardChild,BoardString,BoardStr,II
	Dim area,area2,Child,width
	With BBS94KK
	If Not IsArray(.Board_Rs) Then .GetBoardCache()
	If Not IsArray(.Board_Rs) Then Exit Sub
	area=.ReadSkins("版块分区表格")
	area2=.ReadSkins("版块分区简洁表格")
	For i=0 To Ubound(.Board_Rs,2)
'	只显示2级
	  If .Board_Rs(0,i)<2 Then
'		Board_Rs()=0深度+1ID+2父ID+3名称+4图片+5简介+6版主+7认证用+8子论坛个数+9子论组+10组类+11版组
		If .Board_Rs(0,i)=0 Then
			BoardString=Split(.Board_Rs(11,i),"|")
			If BoardString(1)="1" Then
				BigBoard=area2
				Child=Int(.Board_Rs(8,i))
				If Child<Int(BoardString(2)) and Child>0 Then
					Width=100\Child
				Else
					width=100\Int(BoardString(2))
				End If
				II=0
			Else
				BigBoard=area
			End If
			If i >= 1 Then
				BoardStr=Replace(BoardStr,"{显示版块}",BoardChild)
				Board=Board&BoardStr
				BoardChild =""
			End IF
			BoardStr=Replace(BigBoard,"{分类名称}",.Board_Rs(3,i))
			Else
				If BoardString(1)="1" or Session(CacheName& "BoardStyle")="1" Then
					Child=Child-Int(.Board_Rs(8,i))
					II=II+1
					If II=Int(BoardString(2)) or II=Child Then
						BoardChild=BoardChild&"<div style='float:left;min-width:"&width&"%'>"&.GetBoardInfo("1",i)&"</div><div style='clear: both;'></div>"
					Else
						BoardChild=BoardChild&"<div style='float:left;width:"&width&"%'>"&.GetBoardInfo("1",i)&"</div>"
					End If
					If II=Child Then BoardChild=BoardChild&"<div style='clear: both;'></div>"
				Else
					BoardChild=BoardChild&.GetBoardInfo("0",i)
				End IF
			End If
		End If
	Next
	BoardStr=Replace(BoardStr,"{显示版块}",BoardChild)
	Board = Board&BoardStr
	Response.Write Board
	End With
End Sub

Function ShowOnline()
	Dim S
	S=BBS94KK.ReadSkins("首页在线统计")
	S=Replace(S,"{显示在线列表}","<span id='showon'></span>")
	Dim BrowserType
	Set BrowserType=New Cls_Browser
		S=Replace(S,"{用户系统}",BrowserType.platform)
		S=Replace(S,"{用户浏览器}",BrowserType.Browser & BrowserType.version)
	Set BrowserType=Nothing
	S=Replace(S,"{用户IP}",BBS94KK.MyIp)
	S=Replace(S,"{建站时间}",BBS94KK.Info(5))
	S=Replace(S,"{在线总数}",BBS94KK.AllOnlineNum)
	S=Replace(S,"{会员数}",BBS94KK.UserOnlineNum)
	S=Replace(S,"{游客数}",BBS94KK.AllOnlineNum-BBS94KK.UserOnlineNum)
	S=Replace(S,"{在线最大数}",BBS94KK.InfoUpdate(7))
	S=Replace(S,"{最大数时间}",BBS94KK.InfoUpdate(8))
	If Session(CacheName&"online")="1" then
		S=S&"<iframe frameborder='0' src='online.asp?id=1' height='0'></iframe>"
	End If
	ShowOnline=S
End Function


'显示生日 94kkBBS2.0没有会员生日时不显示
Sub ShowBirthday()
	Dim S
	If BBS94KK.Cache.valid("Birthday") then
		S=Split(BBS94KK.Cache.Value("Birthday"),"|")
		If S(0)="0" Then Exit Sub
		BBS94KK.ShowTable S(0),S(1)
	Else
		Dim Rs,Arr_Rs,I,Num,UserBirthday
		Set Rs=BBS94KK.Execute("Select Name,Birthday From [KK_User] where Month(Birthday)=Month(now) and day(Birthday)=day(now)")
		IF Not Rs.eof Then Arr_Rs=Rs.getrows()
		Rs.Close
		Set Rs=Nothing
		Num=0
		If IsArray(Arr_Rs) Then
			For i = 0 to UBound(Arr_Rs,2)
				Num=Num+1
				UserBirthday=UserBirthday&"&nbsp;&nbsp; <img src=""images/Icon/Birthday.gif"" alt='生日' /><a href=""userinfo.asp?name="&Arr_Rs(0,i)&""">祝"&Arr_Rs(0,i)&"生日快乐</a>&nbsp; &nbsp;"
			Next
		End If
		If i>5 Then UserBirthday="<marquee onMouseOver=""this.stop()"" onMouseOut=""this.start()"" scrollamount=""3"" >"&UserBirthday&"</marquee>"
		If Num=0 Then
			S="0|0"
		Else	 
			S="今天共有 "&num&" 位会员过生日"
			BBS94KK.ShowTable S,UserBirthday
			S=S&"|"&UserBirthday
		End If
		BBS94KK.Cache.add "Birthday",S,dateadd("n",1200,now)
	End If
End Sub

Sub ShowLink()
	Dim rs,Arr_Rs,I,Temp,lpic
	If BBS94KK.Cache.valid("LinkInfo") then
		Temp=BBS94KK.Cache.Value("LinkInfo")
	Else
		Set Rs=BBS94KK.Execute("Select ID,Orders,BbsName,Url,pic,Readme,pass,Ispic From[KK_Link] where pass=1 and IsIndex=1 order by ispic,orders")
		If Rs.Eof Then
			Exit Sub
		Else
			Arr_Rs=Rs.GetRows
			Rs.Close
			Set Rs=Nothing
			For i=0 To Ubound(Arr_Rs,2)
			If Arr_rs(7,i)=0 Then lpic=Arr_rs(2,i) Else Lpic="<img src="""&Arr_rs(4,i)&""" border=0 title="""&Arr_rs(5,i)&""" width=""88"" height=""31"">"
			Temp=Temp&"<td align=""center""><a target=""_blank"" href="""&Arr_rs(3,i)&""">"&lpic&"</a></td>"
			IF (I+1) mod 7 = 0  Then Temp=Temp&"</tr><tr>"
			Next
			Temp="<table width=""100%""  border=""0"" cellpadding=""0"" cellspacing=""5""><tr>"&Temp&"</tr></table>"
			BBS94KK.Cache.add "LinkInfo",Temp,dateadd("n",10000,now)
		End If
	End If
	BBS94KK.ShowTable "论坛联盟 【<a href='Linkinfo.asp'>全部友情链接</a>】【<a href='link.asp' target='hiddenframe' onclick='AutoLink()'>自助申请连接</a>】","<div id='Link'>"&Temp&"</div><div id='ShowAddLink' name='ShowAddLink' style='display:none'></div>"
End Sub










Function ShowNewHot()
BBS94KK.ShowTable"新帖<span style='margin-left:50%'>热帖</span>","<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td style='border-right:1px "&BBS94KK.SkinsPIC(0)&" dotted' width='50%'>"&GetNewTopic(1,5)&"</td><td width='50%'>"&GetNewTopic(2,5)&"</td></tr></table>"
End Function
Function GetNewTopic(flag,Num)
Dim Rs,Sql,Noshow,i,S
Noshow=BBS94KK.NoShowTopic()
If BBS94KK.Cache.valid("IndexNewTopic"&Flag) then
  GetNewTopic=BBS94KK.Cache.Value("IndexNewTopic"&Flag)
Else
  If Noshow="" Then NoShow="0"
  S="":I=0
  If Flag=1 Then
  Sql="select TopicID,Name,Face,Caption,boardid,lasttime,SqlTableID From [KK_topic] where isdel=False And BoardID not in("&Noshow&")  order by lasttime DESC"
  Else
  Sql="select TopicID,Name,Face,Caption,BoardID,LastTime,SqlTableID From [KK_topic] where isdel=False And BoardID not in("&Noshow&") And DATEDIFF('d',[LastTime],'"&BBS94KK.NowBbsTime&"')<7 order by ReplyNum DESC"
  End If
  Set Rs=BBS94KK.Execute(Sql)
  Do while not Rs.eof
  I=I+1
  If I>Int(Num) Then Exit Do 
  S=S&"<tr><td height=25 width=1><img src=""pic/face/"&Rs("face")&".gif""></td><td><a href=""Show.asp?BoardID="&Rs("BoardID")&"&ID="&Rs("topicid")&"&TB="&Rs("SqlTableID")&""">"&BBS94KK.Fun.StrLeft(Rs("Caption"),40)&"</a></td><td><a href=UserInfo.asp?name="&Rs("Name")&">"&Rs("Name")&"</a></td></tr>"
  Rs.movenext
  Loop
  Rs.Close
  GetNewTopic="<table width='100%' border='0' cellspacing='0' cellpadding='0'>"&S&"</table>"
  BBS94KK.Cache.add "IndexNewTopic"&Flag,GetNewTopic,dateadd("n",20,now)
End If
End Function















%>
