<%
function mingxingtop(topmax)
	dim sql,rs
select case mxtop

  case 1
  	mxtop_type=" 今日 "
	sql="select top "&topmax&" username,count(*) from (select  username from bbsxp_threads where posttime> date() union all select username from bbsxp_posts where posttime> date() ) group by username order by count(*) desc"


  case 2
  	mxtop_type=" 本周 "
	sql="select top "&topmax&" username,count(*) from (select  username from bbsxp_threads where posttime>Date()-weekday(date(),2) union all select username from bbsxp_posts where posttime>Date()-weekday(date(),2) ) group by username order by count(*) desc"


  case 3
  	mxtop_type=" 本月 "
	sql="select top "&topmax&" username,count(*) from (select  username from bbsxp_threads where year(posttime)=year(date()) and Month(posttime)=month(Date()) union all select username from bbsxp_posts where year(posttime)=year(date()) and Month(posttime)=month(Date()) ) group by username order by count(*) desc"


  case 4
  	mxtop_type=" 年度 "
	sql="select top "&topmax&" username,count(*) from (select  username from bbsxp_threads where year(posttime)=year(date()) union all select username from bbsxp_posts where year(posttime)=year(date()) ) group by username order by count(*) desc"


  case 5
  	mxtop_type=" 真正 "
	sql="select top "&topmax&" username,count(*) from (select  username from bbsxp_threads union all select username from bbsxp_posts ) group by username order by count(*) desc"
  case else


  	mxtop_type=" 今日 "
	sql="select top "&topmax&" username,count(*) from (select  username from bbsxp_threads where posttime>date() union all select username from bbsxp_posts where posttime>date() ) group by username order by count(*) desc"
end select
	set rs=conn.execute(sql)
	if rs.eof then
		mingxingtop=mxtop_type&"等待你的新贴" 
	else
		mingxingtop=mxtop_type&"   排行  "&topmax&"：<br> "
		dim c
		c=0
		do while not rs.eof
			mingxingtop=mingxingtop&""&"【 <a target=_blank href=Profile.asp?UserName="&rs(0)&">"&rs(0)&"</a>"&" "&rs(1)&"帖 】 &nbsp;"
			rs.movenext
			c=c+1
			if c=topmax then exit do
		loop
	end if
end function

%>