<%
sub mingxing()
	'头部文件
	response.write("<tr>")
	dim sql,rs,F_or_M,username,posttopic,mingxing_1_type,mingxing_2_type
	
'显示第一列的头像
select case mingxa
  case 1
  	mingxing_1_type="今日"
	sql="select top 1 username,count(username) from forum where lasttime>Date() group by username order by count(username) desc"
  case 2
  	mingxing_1_type="本周"
	sql="select top 1 username,count(username) from forum where lasttime>Date()-weekday(date(),2) group by username order by count(username) desc"
  case 3
  	mingxing_1_type="本月"
  	sql="select top 1 username,count(username) from forum where year(lasttime)=year(date()) and Month(lasttime)=month(Date()) group by username order by count(username) desc"
  case 4
  	mingxing_1_type="今年"
  	sql="select top 1 username,count(username) from forum where year(lasttime)=year(Date()) group by username order by count(username) desc"
  case 5
  	mingxing_1_type="真正"
  	sql="select top 1 username,posttopic from [user] order by posttopic desc"
  case else
  	mingxing_1_type="今日"
	sql="select top 1 username,count(username) from forum where lasttime>Date() group by username order by count(username) desc"
end select
	set rs=conn.execute(sql)
if rs.eof then
	response.write("<TD vAlign=middle align=middle width='5%' bgcolor=FFFFFF> <IMG height=27 src='images/male.gif' width=25 align=absMiddle>")
	response.write("</TD>")
	response.write("<TD vAlign=top align=middle width='45%' class=a3>")
	response.write("<table border=0 width='100%'>")
	response.write("<tr>")
	response.write("<td width=44% valign=top> <strong>")
	response.write("<font color=#ff0000>"&mingxing_1_type&"</font>灌水<font color=#DA9136>状元</font>")
	response.write("</strong> <font color=#9999ff>照片-=></font>")
	response.write("<p align=left>姓　　名：<font color=#ff0000>等你来改写</font> <br>")
	'======================================================================================
	response.write "等级：<img src='images/level/0.gif' border=0>"
	response.write "<br><font color=red>"&mingxing_1_type & "</font>发贴：<img src=images/boy.gif width=5 height=8 alt='<font color=#ff0000>零</font> 篇'>"
	response.write "<br>个人财产：<img src=images/bar/exp.gif width=5 height=8 alt='未知'>"
	response.write "<br>社区经验：<img src=images/bar/exp.gif width=5 height=8 alt='未知'>"
	response.write "<br>个人体力：<img src=images/bar/exp.gif width=5 height=8 alt='未知'>"
	'========================================================================================
	response.write("<br>发送短信：<font color=#ff0000>空</font>")
	response.write("</td><td width=50% valign=middle align=center><img src='images/waitforyou.gif' border=0></td></table></TD>")
  else
  	username=rs(0)
  	posttopic=rs(1)
	'================================================================
	sql="select membercode,money,usermail,userface,sex,experience,userlife from [user] where username='"&username&"'"
	'================================================================
	set rs=conn.execute(sql)
	if rs(4)="♂" or rs(4)="male" then
		F_or_M="male.gif"
	elseif rs(4)="♀" or rs(4)="female" then
		F_or_M="female.gif"
	elseif rs(4)="" then
	        F_or_M="male.gif"	
	end if
	response.write("<TD vAlign=middle align=middle width='5%' bgcolor=FFFFFF> <IMG height=27 src='images/"&F_or_M&"' width=25 align=absMiddle>")
	response.write("</TD>")
	response.write("<TD vAlign=top align=middle width='45%' class=a3>")
	response.write("<table border=0 width='100%'>")
	response.write("<tr>")
	response.write("<td width=54% valign=top> <strong>")
	response.write("<font color=#ff0000>"&mingxing_1_type&"</font>灌水<font color=#DA9136>状元</font>")
	response.write("</strong> <font color=#9999ff>照片-=></font>")
	response.write("<p align=left>姓　　名：<font color=blue>"&username&"</font> <br>")
	'==============================================================
	if rs(0)=2 then
	response.write "等级：<img src=images/level/vip.gif>"
	elseif rs(0)=3 then
	response.write "等级：<img src=images/level/banzhu.gif>"
	elseif rs(0)=4 then
	response.write "等级：<img src=images/level/chaojibanzhu.gif>"
	elseif rs(0)=5 then
	response.write "等级：<img src=images/level/guanliyuan.gif>"
	elseif rs(0)=6 then
	response.write "等级：<img src=images/level/admin.gif>"
	elseif rs(0)<2 or rs(5)<51 then
	response.write "等级：<img src=images/level/1.gif>"	
	elseif rs(0)<2 or rs(5)<151 then
	response.write "等级：<img src=images/level/2.gif>"
	elseif rs(0)<2 or rs(5)<501 then
	response.write "等级：<img src=images/level/3.gif>"
	elseif rs(0)<2 or rs(5)<1001 then
	response.write "等级：<img src=images/level/4.gif>"
	elseif rs(0)<2 or rs(5)<2001 then
	response.write "等级：<img src=images/level/5.gif>"
	elseif rs(0)<2 or rs(5)<4001 then
	response.write "等级：<img src=images/level/6.gif>"
	elseif rs(0)<2 or rs(5)<8001 then
	response.write "等级：<img src=images/level/7.gif>"
	elseif rs(0)<2 or rs(5)<12001 then
	response.write "等级：<img src=images/level/8.gif>"
	elseif rs(0)<2 or rs(5)<20001 then
	response.write "等级：<img src=images/level/9.gif>"
	elseif rs(0)<2 or rs(5)<30001 then
	response.write "等级：<img src=images/level/10.gif>"
	elseif rs(0)<2 or rs(5)<50001 then
	response.write "等级：<img src=images/level/11.gif>"	
	elseif rs(0)<2 or rs(5)<70001 then
	response.write "等级：<img src=images/level/12.gif>"
	elseif rs(0)<2 or rs(5)<100001 then
	response.write "等级：<img src=images/level/13.gif>"
	elseif rs(0)<2 or rs(5)<130001 then
	response.write "等级：<img src=images/level/14.gif>"
	elseif rs(0)<2 or rs(5)<160001 then
	response.write "等级：<img src=images/level/15.gif>"
	elseif rs(0)<2 or rs(5)<200001 then
	response.write "等级：<img src=images/level/16.gif>"
	elseif rs(0)<2 or rs(5)<230001 then
	response.write "等级：<img src=images/level/17.gif>"
	elseif rs(0)<2 or rs(5)<260001 then
	response.write "等级：<img src=images/level/18.gif>"
	elseif rs(0)<2 or rs(5)<300001 then
	response.write "等级：<img src=images/level/19.gif>"
	elseif rs(0)<2 or rs(5)>300000 then
	response.write "等级：<img src=images/level/20.gif>"
	end if
	response.write "<br><font color=red>"&mingxing_1_type & "</font>发贴：<font color=red> " & posttopic & "</font> 篇"
	if rs(1)>10000 then
		response.write "<br>个人财产："&rs(1)
	else
		response.write "<br>个人财产：<img src=images/bar/exp.gif width=" & (rs(1)*0.005)+5 & " height=8 alt="&rs(1)&">"
	end if
	if rs(5)>10000 then
		response.write "<br>社区经验："&rs(5)
	else		
		response.write "<br>社区经验：<img src=images/bar/exp.gif width=" & (rs(5)*0.005)+5 & " height=8 alt="&rs(5)&">"
	end if	
	if rs(6)>1000 then
		response.write "<br>个人体力："&rs(6)
	else		
		response.write "<br>个人体力：<img src=images/bar/exp.gif width=" & (rs(6)*0.5)+5 & " height=8 alt="&rs(6)&">"
	end if
	'==============================================================	
	response.write("<br>发送短信：")
	if trim(rs(2))<>"" then
    		response.write("<a href=profile.asp?username="&username&"#><font color=olive>飞鸽传书</font></a>")
  	end if
	response.write("</td><td width=50% valign=middle align=center> <a href=profile.asp?username="&username&" title='我厉害吗？哈~~~')><img border=0 src=' "&rs(3)&" ' width='64' height='64'></a></td></table></TD>")
  end if
	
'显示第二列的头像
select case mingxb
  case 1
  	mingxing_2_type="今日"
	sql="select top 2 username,count(username) from forum where lasttime>Date() group by username order by count(username) desc"
  case 2
  	mingxing_2_type="本周"
	sql="select top 2 username,count(username) from forum where lasttime>Date()-weekday(date(),3) group by username order by count(username) desc"
  case 3
  	mingxing_2_type="本月"
  	sql="select top 2 username,count(username) from forum where year(lasttime)=year(date()) and Month(lasttime)=month(Date()) group by username order by count(username) desc"
  case 4
  	mingxing_2_type="今年"
  	sql="select top 2 username,count(username) from forum where year(lasttime)=year(Date()) group by username order by count(username) desc"
  case 5
  	mingxing_2_type="真正"
  	sql="select top 2 username,posttopic from [user] order by posttopic desc"
  case else
  	mingxing_2_type="今日"
	sql="select top 2 username,count(username) from forum where lasttime>Date() group by username order by count(username) desc"
end select
	set rs=conn.execute(sql)
	
if (not rs.eof) and mingxa=mingxb then
	rs.movenext
end if	
if rs.eof then
	response.write("<TD vAlign=middle align=middle width='5%' bgcolor=FFFFFF> <IMG height=27 src='images/male.gif' width=25 align=absMiddle>")
	response.write("</TD>")
	response.write("<TD vAlign=top align=middle width='45%' class=a3>")
	response.write("<table border=0 width='100%'>")
	response.write("<tr>")
	response.write("<td width=44% valign=top> <strong>")
	if mingxa=mingxb then
		response.write("<font color=#ff0000>"&mingxing_2_type&"</font>灌水<font color=#DA9136>榜眼</font>")
	else
		response.write("<font color=#ff0000>"&mingxing_2_type&"</font>灌水<font color=#DA9136>状元</font>")
	end if
	response.write("</strong> <font color=#9999ff>照片-=></font>")
	response.write("<p align=left>姓　　名：<font color=#ff0000>等你来改写</font> <br>")
	'======================================================================================
	response.write "等级：<img src='images/level/0.gif' border=0>"
	response.write "<br><font color=red>"&mingxing_2_type & "</font>发贴：<img src=images/boy.gif width=5 height=8 alt='<font color=#ff0000>零</font> 篇'>"
	response.write "<br>个人财产：<img src=images/bar/exp.gif width=5 height=8 alt='未知'>"
	response.write "<br>社区经验：<img src=images/bar/exp.gif width=5 height=8 alt='未知'>"
	response.write "<br>个人体力：<img src=images/bar/exp.gif width=5 height=8 alt='未知'>"
	'========================================================================================
	response.write("<br>发送短信：<font color=#ff0000>空</font>")
	response.write("</td><td width=50% valign=middle align=center><img src='images/waitforyou.gif' border=0></td></table></TD>")
  else
  	username=rs(0)
  	posttopic=rs(1)
	'================================================================
	sql="select membercode,money,usermail,userface,sex,experience,userlife from [user] where username='"&username&"'"
	'================================================================
	set rs=conn.execute(sql)
	if rs(4)="♂" or rs(4)="male" then
		F_or_M="male.gif"
	elseif rs(4)="♀" or rs(4)="female" then
		F_or_M="female.gif"
	elseif rs(4)="" then
	        F_or_M="male.gif"	
	end if
	response.write("<TD vAlign=middle align=middle width='5%' bgcolor=FFFFFF> <IMG height=27 src='images/"&F_or_M&"' width=25 align=absMiddle>")
	response.write("</TD>")
	response.write("<TD vAlign=top align=middle width='45%' class=a3>")
	response.write("<table border=0 width='100%'>")
	response.write("<tr>")
	response.write("<td width=54% valign=top> <strong>")
	if mingxa=mingxb then
		response.write("<font color=#ff0000>"&mingxing_2_type&"</font>灌水<font color=#DA9136>榜眼</font>")
	else
		response.write("<font color=#ff0000>"&mingxing_2_type&"</font>灌水<font color=#DA9136>状元</font>")
	end if
	response.write("</strong> <font color=#9999ff>照片-=></font>")
	response.write("<p align=left>姓　　名：<font color=blue>"&username&"</font> <br>")
	'==============================================================
	if rs(0)=2 then
	response.write "等级：<img src=images/level/vip.gif>"
	elseif rs(0)=3 then
	response.write "等级：<img src=images/level/banzhu.gif>"
	elseif rs(0)=4 then
	response.write "等级：<img src=images/level/chaojibanzhu.gif>"
	elseif rs(0)=5 then
	response.write "等级：<img src=images/level/guanliyuan.gif>"
	elseif rs(0)=6 then
	response.write "等级：<img src=images/level/admin.gif>"
	elseif rs(0)<2 or rs(5)<51 then
	response.write "等级：<img src=images/level/1.gif>"	
	elseif rs(0)<2 or rs(5)<151 then
	response.write "等级：<img src=images/level/2.gif>"
	elseif rs(0)<2 or rs(5)<501 then
	response.write "等级：<img src=images/level/3.gif>"
	elseif rs(0)<2 or rs(5)<1001 then
	response.write "等级：<img src=images/level/4.gif>"
	elseif rs(0)<2 or rs(5)<2001 then
	response.write "等级：<img src=images/level/5.gif>"
	elseif rs(0)<2 or rs(5)<4001 then
	response.write "等级：<img src=images/level/6.gif>"
	elseif rs(0)<2 or rs(5)<8001 then
	response.write "等级：<img src=images/level/7.gif>"
	elseif rs(0)<2 or rs(5)<12001 then
	response.write "等级：<img src=images/level/8.gif>"
	elseif rs(0)<2 or rs(5)<20001 then
	response.write "等级：<img src=images/level/9.gif>"
	elseif rs(0)<2 or rs(5)<30001 then
	response.write "等级：<img src=images/level/10.gif>"
	elseif rs(0)<2 or rs(5)<50001 then
	response.write "等级：<img src=images/level/11.gif>"	
	elseif rs(0)<2 or rs(5)<70001 then
	response.write "等级：<img src=images/level/12.gif>"
	elseif rs(0)<2 or rs(5)<100001 then
	response.write "等级：<img src=images/level/13.gif>"
	elseif rs(0)<2 or rs(5)<130001 then
	response.write "等级：<img src=images/level/14.gif>"
	elseif rs(0)<2 or rs(5)<160001 then
	response.write "等级：<img src=images/level/15.gif>"
	elseif rs(0)<2 or rs(5)<200001 then
	response.write "等级：<img src=images/level/16.gif>"
	elseif rs(0)<2 or rs(5)<230001 then
	response.write "等级：<img src=images/level/17.gif>"
	elseif rs(0)<2 or rs(5)<260001 then
	response.write "等级：<img src=images/level/18.gif>"
	elseif rs(0)<2 or rs(5)<300001 then
	response.write "等级：<img src=images/level/19.gif>"
	elseif rs(0)<2 or rs(5)>300000 then
	response.write "等级：<img src=images/level/20.gif>"
	end if
	response.write "<br><font color=red>"&mingxing_2_type & "</font>发贴：<font color=red> " & posttopic & "</font> 篇"
	if rs(1)>10000 then
		response.write "<br>个人财产："&rs(1)
	else
		response.write "<br>个人财产：<img src=images/bar/exp.gif width=" & (rs(1)*0.005)+5 & " height=8 alt="&rs(1)&">"
	end if
	if rs(5)>10000 then
		response.write "<br>社区经验："&rs(5)
	else		
		response.write "<br>社区经验：<img src=images/bar/exp.gif width=" & (rs(5)*0.005)+5 & " height=8 alt="&rs(5)&">"
	end if	
	if rs(6)>1000 then
		response.write "<br>个人体力："&rs(6)
	else		
		response.write "<br>个人体力：<img src=images/bar/exp.gif width=" & (rs(6)*0.5)+5 & " height=8 alt="&rs(6)&">"
	end if
	'==============================================================	
	response.write("<br>发送短信：")
	if trim(rs(2))<>"" then
    		response.write("<a href=profile.asp?username="&username&"#><font color=olive>飞鸽传书</font></a>")
  	end if
	response.write("</td><td width=50% valign=middle align=center> <a href=profile.asp?username="&username&" title='我厉害吗？哈~~~')><img border=0 src=' "&rs(3)&" ' width='64' height='64'></a></td></table></TD>")
  end if


	'尾部文件
	response.write("</TR>")
rs.close
set rs=nothing
end sub 

function mingxingtop(topmax)
	dim sql,rs
	sql="select top "&topmax&" username,count(username) from forum where lasttime>Date() group by username order by count(username) desc"
	set rs=conn.execute(sql)
	if rs.eof then
		mingxingtop="今日暂时无人发贴" 
	else
		mingxingtop=""
		dim c
		c=0
		do while not rs.eof
			mingxingtop=mingxingtop&"<font face=Wingdings color=blue>v</font> "&rs(0)&"[<font color=red>"&rs(1)&"</font>]&nbsp;&nbsp;"
			rs.movenext
			c=c+1
			if c=topmax then exit do
		loop
	end if
end function
%>