<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_popfun.asp -->
<!-- #include file=pet_conn.asp -->
<!--#include file=pet_config.asp-->
<%
DEF_BBS_HomeUrl = "../../"
dim menu,savem,rsbank,rssql,chentitle,chenbackasp,stats,errmsg,founderr

chentitle="宠物排行榜"
chenbackasp="petcenter.asp"
stats="宠物排行榜"
BBS_SiteHead DEF_SiteNameString&" "&DEF_BBS_Name,GBL_board_ID,">>&nbsp;<a href=petcenter.asp>宠物中心</a>&nbsp;>>&nbsp;" & chentitle

if GBL_CHK_User="" then
	AlarmErrmsg
else
    dim allpetpeople,mypetname,mypet,levelpic,mypetlevel,username,level1,petatk,petdef,petdead
    Dim Rs,SQL
    
%>
<% If GBL_TableHeadString <> "" Then %><table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableHeadString%></td></tr></table><% End If %>
<table width="<%=DEF_BBS_ScreenWidth%>" border="0" cellspacing="1" cellpadding="5" align="center" class=TBone>
  <tr>
    <td height=27 align="center" class=tbhead2><b><font class=HeadFont><%=stats%></font></b></td>
  </tr>
  <tr>
    <td class=tbbg1>
    

<table width="100%" border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td width="30%">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
                    <tr> 
                      <td><div align="center"><img src="images/pet/28.gif" width="150" height="150"></div></td>
                    </tr>
                  </table>
                  <br>
                  <br>
                  <table width="90%"  border="0" align="center" cellpadding="3" cellspacing="3">
                    <tr> 
                      <td><div align="center"></div>
<!-- #include file=petnav.asp --></td>
                    </tr>
                  </table>

                  <p>&nbsp;</p>
                  </td>
                <td>

<%
    select case lcase(request("action"))
        case "pkon"
%>
                  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="3">
                    <tr>
                      <td width="20%"><div align="center">宠物主人</div></td>
                      <td width="20%"><div align="center">宠物名字</div></td>
                      <td width="15%"><div align="center">宠物等级</div></td>
                      <td width="15%"><div align="center">宠物攻击力</div></td>
                      <td width="15%"><div align="center">宠物防御力</div></td>
                      <td width="15%"><div align="center">宠物状态</div></td>
                    </tr>
<%
            SQL = "SELECT * FROM mypetdata where openpk<2 ORDER BY mypetexp DESC"
            set rs = connpet.execute(SQL)
            while not rs.eof 
                    level1=int(rs("mypetlevel")/2)
                    petatk=rs("mypetatk")+rs("item1")+rs("item2")+2+level1
                    petdef=rs("mypetdef")+rs("item3")+rs("item4")+rs("item5")+3+level1
                    if rs("mypethp")<1 or rs("mypetsp")<1 then 
                        petdead="死亡"
                        else
                        petdead="生存"
                    end if
%>
                    <tr><td width='20%'><div align='center'><a href="../../User/LookUserinfo.asp?name=<%=rs("username")%>"><%=rs("username")%></a></div></td>
                    <td width="20%"><div align="center"><a href="viewpet.asp?username=<%=rs("username")%>"><%=rs("mypet")%></a></div></td>
                    <td width='15%'><div align='center'><%=rs("mypetlevel")%></div></td>
                    <td width='15%'><div align='center'><%=petatk%></div></td>
                    <td width='15%'><div align='center'><%=petdef%></div></td>
                    <td width='15%'><div align='center'><%=petdead%></div></td>
                    </tr>
<%              rs.movenext    
            wend
            rs.close
%>                    
                    </table>

<%
        case else 'pettop
%>
                  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="28%"><div align="center">宠物照片</div></td>
                      <td width="24%"><div align="center">宠物名字</div></td>
                      <td width="24%"><div align="center">宠物等级</div></td>
                      <td width="24%"><div align="center">宠物主人</div></td>
                    </tr>

<%
            SQL = "SELECT top 10 username,mypet,mypetlevel,mypetname FROM mypetdata ORDER BY mypetlevel desc,mypetexp DESC"
            set rs = connpet.execute(SQL)
            dim num
            num = 0
            while not rs.eof and num < 10
                levelpic=int(rs("mypetlevel")/10)
                if levelpic>10 then levelpic=11 end if
%>
                    <tr><td width='28%'><div align='center'><IMG src='images/pet/<%=rs("mypetname")%>/<%=rs("mypetname")%><%=levelpic%>.gif'></div></td>
                    <td width='24%'><div align='center'><a href="viewpet.asp?username=<%=rs("username")%>"><%=rs("mypet")%></a></div></td>
                    <td width='24%'><div align='center'><%=rs("mypetlevel")%></div></td>
                    <td width='24%'><div align='center'><a href="../../User/LookUserinfo.asp?name=<%=rs("username")%>"><%=rs("username")%></a></div></td>
                    </tr>
<%              rs.movenext    
                num = num + 1
            wend
            rs.close
%>
                    </table>
<%            
    end select
%>                  
                </td>
              </tr>
            </table> 


	</td></tr></table>
<% If GBL_TableBottomString <> "" Then %><table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableBottomString%></td></tr></table><% End If %>
<%    
end if

SiteBottom 
If GBL_SiteBottomString <> "" Then Response.Write GBL_SiteBottomString
%>